5 ms·
Next article should be about times/dates. Times and dates are F*cking hard sometimes :-)
by seivan 13y ago
Next article should be about times/dates.
Times and dates are F*cking hard sometimes :-)
- estebank 13y agoJon Skeet's "The joys of date/time arithmetic" http://msmvps.com/blogs/jon_skeet/archive/2010/12/01/the-joys-of-date-time-arithmetic.aspx http://msmvps.com/blogs/jon_skeet/archive/2010/12/01/the-joy... His talk in London Dev Days 2009, also goes into problems you can have with dates and timezones (including Argentina's 2009 last minute time zone change back into not using daylight saving time). http://vimeo.com/7516539 http://vimeo.com/7516539
- jiggy2011 13y agohttp://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time http://infiniteundo.com/post/25326999628/falsehoods-programm...
- InclinedPlane 13y agoIt still annoys me that unix-time is not monotonically increasing. It was such a beautiful idea and it got totally screwed up by the lame idea of leap seconds.
- Thrymr 13y agoUnix time is monotonically increasing, as long as there are no negative leap seconds (and there never have been). It's just not uniformly increasing, since it tracks UTC.
- InclinedPlane 13y agoI think you have the concept of leap-second backwards. A positive leap-second means that the time-of-day is held for one additional second. Since unix time does not respect leap seconds there are 35 different unix time values at the resolution of seconds which refer to periods of time lasting 2 seconds instead of one. And that means that unix time at a resolution higher than a second will jump backwards at those 35 different leap seconds.
- masklinn 13y ago> I think you have the concept of leap-second backwards. A positive leap-second means that the time-of-day is held for one additional second. Since unix time does not respect leap seconds there are 35 different unix time values at the resolution of seconds which refer to periods of time lasting 2 seconds instead of one. Monotonic functions can yield repeated values, they don't have to be strictly increasing or decreasing. A constant function is monotone. > And that means that unix time at a resolution higher than a second will jump backwards at those 35 different leap seconds. Yes sub-second timestamps won't be monotonic, but UNIX time (or POSIX time) is only defined with a resolution of a second, so it is monotonic.
- thaumasiotes 13y agoThis isn't quite correct, and as the grandparent applies the concept it is definitely incorrect. A monotonically increasing function may never repeat a value. A constant function is not monotonically increasing; it is monotonically nondecreasing (and of course, also monotonically nonincreasing).
- InclinedPlane 13y agoPOSIX time.h defines "unix time" as seconds since the epoch in type... time_t, which (according to the POSIX standard) can be either an integer or a floating point value. In practice though, "unix time" is merely a convention which is based off of the POSIX standard.