A brief history of (and agenda for) time zone libraries
eggert at twinsun.com
Sat May 15 07:08:44 UTC 1993
Summary: The GNU C library is derived from Arthur David Olson's 1989 time zone
code, with extensive changes. The good news is that these changes improve the
modularity of Olson's code; the bad news is that it is now hard to merge some
of Olson's more recent improvements into the GNU C library. Despite the bad
news, Olson's fixes and improvements should be merged into the GNU C library
somehow. While we're on the subject, the Linux time zone code also comes from
Olson's 1989 code, but has only few minor changes; it should be updated to the
current edition of Olson's code.
Olson's 1989 code.
The original timezone code was written by Arthur David Olson. This public
domain code has a good reputation. Even the Posix standard comes as close as
a standard can to saying ``This is good stuff -- check it out!''; see Posix
1003.1-1990 section B.8.1.1, lines 4195-4201. The most famous publication of
Olson's code was in comp.sources.unix 18, 111-117 (19 April 1989) -- see
GNU C Library.
The GNU C Library (see prep.ai.mit.edu:pub/gnu/glibc-1.05.tar.z) is derived
from Olson's 1989 code. Here are its changes:
1. Rewrite the Makefile to use GNU make and GNU libc standards.
2. Split localtime.c into several smaller, more modular files. These
files are: __tzset.c gmtime.c mktime.c offtime.c tzfile.c tzset.c.
Completely rewrite these files in the GNU style.
3. Add some time functions not in Olson's package, e.g. adjtime.
4. Update some of the New Zealand time zone rules.
Linux's code for timezones (see
tsx-11.mit.edu:pub/linux/sources/sbin/timesrc.tar.Z) is also derived from
Olson's 1989 code, but it has only the following minor changes:
1. Rewrite the Makefile to meet Linux standards.
2. Add a few #includes, or change them from "" form to <> form.
Olson's current edition.
Arthur David Olson is still maintaining both the code and the corresponding
timezone database (see elsie.nci.nih.gov:pub/tz*). The differences between
Olson's 1989 code and his current edition are as follows:
1. Fix some minor Makefile portability problems.
2. Fix some bugs in the C code, and avoid some possible core dumps.
3. Bring the leap second database up-to-date through June 1993.
4. Update the time zone database for Israel, Australia (which is
particularly wild and woolly -- they hold voter referendums to change
the timezone rules!), New Zealand, Britain, Portugal, Starke County
Indiana, Saskatchewan. Remove the nonexistent US Pacific Presidential
Election Time, which caused some problems late last year on some West
Coast Suns. The New Zealand updates are a superset of the GNU C
5. Add a -y option to zic to specify a command that tests for
arbitrary year types; this is used in some of the new time zone rules.
Olson's changes should be propagated into both Linux and the GNU C library.
Linux should update to Olson's current edition; this should be a simple merge.
By the way, the Linux code should also give credit to Olson instead of
silently removing his README file; this will help prevent the current
situation from recurring.
The GNU C library changes fall into two categories: (A) changes to Olson's
localtime.c, and (B) everything else. Merging (B) is easy, almost as easy as
merging the Linux timezone code, and I've already submitted patches to the GNU
C library developers to do this. Merging (A) is harder, since the GNU C
library has split up localtime.c into lots of little pieces. The GNU C
library changes generally improve Olson's code -- they make the module
interfaces cleaner, and the code is easier to follow. Unfortunately, it is
now hard to tell how to propagate Olson's localtime.c changes and improvements
into the GNU C library. The best person to do this propagation is the person
who split up localtime.c in the first place. Another possibility is for the
GNU C library to switch to a version of localtime.c that is as close as
possible to Olson's latest version; that might simplify future maintenance.
More information about the tz