Time zone: the next generation

Kevin Kenny kennykb at crd.ge.com
Thu Mar 3 20:20:49 UTC 2005

I've done a good bit of similar code for the Tcl programming
language (see http://www.tcl.tk/cgi-bin/tct/tip/173 for details).
The implementation there can handle the proleptic Julian calendar,
with a defined change date.

There are a number of caveats worth mentioning:

    - Prior to the Julian conversion, different locales had different
      rules for when the number of the year changed.  In and before
      1752 in Great Britain, for instance, the number of the year changed
      on 25 March; 1-24 March belonged to the previous year!  With
      the adoption of the Gregorian calendar, the change was
      universally 1 January.  (For this reason, you'll sometimes see
      eighteenth-century dates as O.S. ("Old Style") or N.S. ("New Style")
      when the year would otherwise be ambiguous.

      I decided for Tcl not to bother with any kind of localized rule
      for year numbering in those circumstances; it was too much of a mess.

    - As you correctly observe, leap years were observed irregularly
      in Rome in Republican and early Imperial times.  In fact, they were
      so irregularly observed that it was occasionally necessary to
      intercalate entire months.  Again, I decided with Tcl not to bother.

    - It appears unnecessary to control skipping the year zero.  I have
      not encountered any locale where there is such a beast; in all cases,
      it appears that the year 1 B.C.E. is followed by the year 1 C.E.

    - I use a message catalog (the same catalog in which I hold localised
      month names) to hold a locale's Julian conversion date, and then
      select the catalog according to LC_TIME.  Tcl's ordinary
      message catalog functionality can be used to change the date.

    - I have not yet troubled to implement anything but Gregorian (or
      hybrid Julian-Gregorian) calendars.  I did a limited amount of
      localization to handle the Japanese civil calendar, but only for
      dates after the Meiji restoration (when it's Gregorian, except
      that years number from the start of an emperor's reign).

Incidentally, Tcl's counterpart to zic (which uses the same input format
as zic) simply uses 64-bit counts of seconds for its transition times.
Also, it doesn't track leap seconds, since Tcl's model of time is
Markus Kuhn's "smoothed universal time" (http://www.cl.cam.ac.uk/~mgk25/uts.txt)
in which leap seconds are handled by changing the length of a second 
by 1 part in 1000 until Tcl's clock is back in sync with UTC.  

73 de ke9tv/2, Kevin KENNY   GE Corporate Research & Development
kennykb at crd.ge.com           P. O. Box 8, Bldg. K-1, Rm. 5B36A
                             Schenectady, New York 12301-0008 USA

More information about the tz mailing list