3 ms·
One of the big problems is application support. How many will break by seeing 60 as current second as opposed to 59 twice?
by tyldum 10y ago
One of the big problems is application support. How many will break by seeing 60 as current second as opposed to 59 twice?
- creshal 10y agoBreak them, fix them, and move on. Must we coddle to every programmer's incompetence?
- m45t3r 10y agoI am sure tons of applications that use gettimeofday() to keep track of time can break in subtle ways when seeing 59 twice. Of course, they're broken considering that there is clock_gettime(), however this is a POSIX interface that is not really monotonic too by default, and the monotonic versions of it are Linux-only implementations.
- JoshTriplett 10y ago> I am sure tons of applications that use gettimeofday() to keep track of time can break in subtle ways when seeing 59 twice. gettimeofday doesn't return hour/minute/second divisions; it just returns seconds/microseconds since the epoch. Functions like strftime and gmtime handle the components of time. And leap seconds don't make applications see 59 twice; they make them see 60 once (58, 59, 60, 0, 1, ...). Quoting the manpages for gmtime and strftime: > tm_sec The number of seconds after the minute, normally in the range 0 to 59, but can be up to 60 to allow for leap seconds. > %S The second as a decimal number (range 00 to 60). (The range is up to 60 to allow for occasional leap seconds.) (Calculated from tm_sec.)