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

Debian, leap seconds, timezones, and zdump



The first leap second since 1998 comes today at 23:59:60 UTC (19:59:60
Eastern Standard Time).  See
http://www.leapsecond.com/notes/leap-watch.htm for some background and
fun things to do then.  See also NIST's leap-second-enabled java
applet at

  http://nist.time.gov/

The announcement was made back in July, but the Debian glibc6 package
hasn't yet been updated so the arcane and deprecated little "zdump"
trick in Linux that allows them to be documented doesn't know about
this one.  No big deal, since most people don't care about time that
precisely, and don't use the "right/" timezones that allow them to be
noticed, but FWIW....

Here are some notes on facilities in some Unix systems to show
evidence of leap seconds.

First, this should work for everyone who cares about time and runs
ntp.  Make sure you're in NTP sync with a host that knows a leap
second is coming.  Look for "leap=01" in the output of this:

 $ ntpq -c rv
 assID=0 status=46f4 leap_add_sec, sync_ntp, 15 events, event_peer/strat_chg,
 version="ntpd 4.2.0a@1:4.2.0a-11-r Mon Mar 14 12:39:28 GMT 2005 (1)"?,
 processor="i686", system="Linux/2.6.10-6-386", leap=01, stratum=3,
 precision=-19, rootdelay=158.366, rootdispersion=77.103, peer=17708,
 refid=82.211.81.145,
 reftime=c76127cd.19f9acff  Sat, Dec 31 2005  8:52:45.101, poll=7,
 clock=0xc7612b1b.74322291, state=4, offset=-0.430, frequency=37.132,
 error=0.572, jitter=1.795, stability=64.092


For enduring knowledge of leap seconds, and accurate calculations of
the difference between two Unix timestamps, one on either side of a
leap second, you need more than ntp.  I'm no expert (help!) but it
appears that on many Unix systems, the "Olson" notion of "right/"
timezones allows the system to understand leap seconds.  Note though
that it is deprecated since it breaks many other things.  But today is
leap-second-day, so lets see what could help accomodate that.

E.g. note the back-to-back output of two date commands, with and
without the "right/" timezone prefix:

 $ date; TZ=right/US/Mountain date; 
 Sat Dec 31 09:56:22 MST 2005
 Sat Dec 31 09:56:00 MST 2005

That prefix tells the date command that the system clock includes all
seconds (including leap seconds) since the unix epoch in 1970.  Since
that is not true on my machine, it is off by the 22 leap seconds since
then.

But tomorrow will it know about the 23rd one?  That depends on
up-to-date timezone files.

The zdump command shows time discontinuities (daylight savings, leap
seconds, and legal changes) for the files installed somewhere like
/usr/share/zoneinfo.  E.g. here is an excerpt of its output on my
Ubuntu 5.10 (Breezy) system:

 $ zdump -v right/UTC
 ...
 right/UTC  Thu Dec 31 23:59:60 1998 UTC = Thu Dec 31 23:59:60 1998 UTC isdst=0 gmtoff=0
 right/UTC  Fri Jan  1 00:00:00 1999 UTC = Fri Jan  1 00:00:00 1999 UTC isdst=0 gmtoff=0

Note the famous 23:59:60 entry for the last leap second.  But note
that it dosen't now about the 2005 leap second, despite the fact that
my release of Ubuntu came out in October of 2005.  The Debian
releases, including unstable, don't seem to be updated either.  But
Redhat's Fedora core 4 is up-to-date, as are RHEL and centos.

zdump works for other time zones also, including daylight savings
times changes:

 $ zdump -v right/US/Mountain | grep 1998
  right/US/Mountain  Sun Apr  5 08:59:59 1998 UTC = Sun Apr  5 01:59:59 1998 MST isdst=0 gmtoff=-25200
  right/US/Mountain  Sun Apr  5 09:00:00 1998 UTC = Sun Apr  5 03:00:00 1998 MDT isdst=1 gmtoff=-21600
  right/US/Mountain  Sun Oct 25 07:59:59 1998 UTC = Sun Oct 25 01:59:59 1998 MDT isdst=1 gmtoff=-21600
  right/US/Mountain  Sun Oct 25 08:00:00 1998 UTC = Sun Oct 25 01:00:00 1998 MST isdst=0 gmtoff=-25200
  right/US/Mountain  Thu Dec 31 23:59:60 1998 UTC = Thu Dec 31 16:59:60 1998 MST isdst=0 gmtoff=-25200
  right/US/Mountain  Fri Jan  1 00:00:00 1999 UTC = Thu Dec 31 17:00:00 1998 MST isdst=0 gmtoff=-25200

 $ zdump -v right/US/Mountain | grep 2005

  right/US/Mountain  Sun Oct 30 07:59:59 2005 UTC = Sun Oct 30 01:59:59 2005 MDT isdst=1 gmtoff=-21600
  right/US/Mountain  Sun Oct 30 08:00:00 2005 UTC = Sun Oct 30 01:00:00 2005 MST isdst=0 gmtoff=-25200

You can get updated time zone tables as indicated at
 http://www.twinsun.com/tz/tz-link.htm

It also includes changes for US daylight savings in 2007.
The package that needs updating for Debian and Ubuntu is "libc6"

See http://www.ucolick.org/~sla/leapsecs/ for tons
more info.

Neal McBurnett                 http://bcn.boulder.co.us/~neal/
Signed and/or sealed mail encouraged.  GPG/PGP Keyid: 2C9EBA60



Reply to: