Re: leap second and Centos

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Once upon a time, Les Mikesell <lesmikesell@xxxxxxxxx> said:
> Helpful, but not exactly concise...  And I don't understand the
> concept of /usr/share/zoneinfo/right/*. Are those supposed to print
> the right time if your clock is left wrong?

Basically, POSIX time doesn't really handle leap seconds.  In theory,
the timeinfo struct can count to 60 (even 61) seconds in a minute.

However, the base time_t is specified as days of exactly 86,400 seconds.
The Linux kernel (and IIRC most other Unix systems) just tick the same
second twice; this June, the time() function will return 1435708799 for
two seconds on the wall clock, and gettimeofday() will count tv_usec
from 0 to 999, then back to 0, without changing tv_sec.

So, there's a hack for things that really want to know leap seconds.  It
is done in the timezone data files; they know the offset from POSIX to
UTC (based on all the leap seconds inserted since the start of the POSIX
epoch, 1970-01-01) and report time that way.

If your kernel never handled leap seconds, and was set to UTC seconds
since 1970-01-01 instead of POSIX seconds, then you could use the
"right" timezone files to see the current time.  However, you'd be out
of step with all the rest of the Internet for anything that uses POSIX
seconds (fileservers for example), and always think the clock was slow
(plus you'd have to run a custom copy of NTP to not try to "fix" the
clock).

-- 
Chris Adams <linux@xxxxxxxxxxx>
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux