Paul Eggert wrote:
> > The first question is how to include tzdata in gnulib.
> > - AFAICS, the main data file (without comments) is tzdata.zi and is about
> > 100 KB large. It can be upgraded simply by copying the newest tzdata.zi
> > from a newer tzdata distribution. Including such a file in gnulib would
> > be OK (re copyright, number of files, total size), right?
>
> No problem with copyright; the file is in the public domain.
>
> > - Whereas including all files from /usr/share/zoneinfo is probably not
> > acceptable (> 1300 files, ca. 6 MB total size).
>
> That can be automatically generated from tzdata.zi, by using zic, the
> source code of which is also in the public domain.
Thanks for the confirmation.
My current plan, in order to cover the two goals
- localtime_r on native Windows,
- nstrftime, c_nstrftime, parse-datetime, which all take a timezone_t
argument,
is to write four pieces of code:
1) code that represents the data for a single time zone in memory,
(based on glibc's tzfile.c),
2) code that reads a binary time zone file, for use on Unix,
(based on glibc's tzfile.c), returning it in the format 1).
3) code that reads a tzdata.zi, for use on Windows,
(based on glibc's zic.c and tzfile.c), returning it in the format 1).
4) an implementation of localtime_r for a given time zone
(based on glibc's tzfile.c:__tzfile_compute, tzset.c:__tz_convert, and
localtime_r).
This should fulfil Gnulib's needs (code under LGPLv2+, small number
of source files, small number and size of data files to include).
Note that this will have to wait for a few weeks. I have more urgent work on
gettext to do first.
Note also: The above approach will need locking, in order to protect caches
(in 1) the data for a single time zone, in 3) the contents of tzdata.zi).
Bruno