FreeBSD handles leapsecond correctly

Jon Dama jd at ugcs.caltech.edu
Tue Jan 3 08:26:23 PST 2006


I think you had the answer more clearly earlier.  Computers display event
times in UTC, but intervals are based on SI seconds (and now finer
granuality).

I might be crazy, but I understand stopwatch seconds after the epoch (SI)
to be the fundamental unit of POSIX time.  Days, Hours, Months, etc
simply does not enter into the consideration except in the context of
"formating functions" such as gmtime(), localtime(), mktime(), etc.

Here I agree that POSIX is lying when it suggests you can get UTC time
out without leapsecond tables, but this does not seem to be a very
fundamental problem.

difftime operates on stopwatch seconds after the epoch.

It is quite informative to realize that time_t has sub-second granularity
whereas struct tm have seconds as their smallest unit of time.  Typically
on any instrument, at least the least significant digit is considered
approximate.  Such will be the case in regards to the POSIX definition of
time for some years into the future.

So chill.

If you just avoid discussing the translation of stopwatch seconds into
minutes/hours/days the problem goes away and we can all chalk up that
conversion of seconds into minutes/hours/days that we all learned in
grade school as another poorly explained simplification and proceed to
unlearn it from our minds.




More information about the freebsd-current mailing list