|
|
|
|
|
by vlovich123
944 days ago
|
|
I feel like that’s unit confusion. Converting from year to day should require you to specify what calendar year you’re in to resolve the ambiguity. Otherwise I set an alarm for today + 1 year and things are off by 6 hours. Time is nasty because there’s lots of overloaded concepts and bugs hide in the implicit conversions between meanings. I’m also kinda curious what the underlying type is. Is it a double or do they use arbitrary precision math and take the perf hit. |
|
A year has two meanings - a calendar year, with all the leap days and seconds and timezones, or a duration of time. The latter is still useful, e.g. when someone states that Proxima Centauri is 4.2 light-years away, they don't want to deal with leap-days.
Decent time libraries have separate ways to deal with durations and dates.