this post was submitted on 14 Dec 2023
220 points (95.8% liked)

Programmer Humor

32479 readers
240 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 3 points 11 months ago (2 children)

.net has a timespan data type specifically for this sort of thing.

[โ€“] [email protected] 1 points 11 months ago* (last edited 11 months ago)

I'm guessing it's not alone. Every time format should come with a distance function and order function, or equivalent. If you have a life, that could mean something like subtraction.

Unfortunately, "should" isn't always enough. Optimally there's also type structure to the return of the function so you can't mix up seconds and days, or calendar and (one of the) standard length days.

load more comments (1 replies)