|
|
|
|
|
by JoshTriplett
3488 days 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.) |
|