[tz] Howard Hinnant's Time Zone Database Parser

Florian Weimer fweimer at redhat.com
Wed Dec 4 10:25:29 UTC 2019


* Howard Hinnant:

> The end-game here is this library has been voted into the C++20
> working draft, to be provided by the std::lib vendors.  And without
> the AUTO_DOWNLOAD feature.  Each platform will provide the database as
> Linux/Mac/BSD do now.
>
> http://eel.is/c++draft/#time
>
> As C++20 becomes more available, my library will be obsoleted by the
> std implementation.  It is a planned obsolesce.  The AUTO_DOWNLOAD will
> functionality will fade into the rearview mirror.

I think I have commented on this before.

The API assumes that time zone have names that identify them, which is
generally not true.  On GNU/Linux, the system time zone is the tzdata
blob in /etc/localtime, and you cannot in general determine a name from
that.  Particularly not a name that you can use to set TZ and get back
the same blob or even the same time zone.  I suspect we could make up a
fake name like SYSTEM for this case.

It's not clear to me whether the expected implementation of the
time_zone * object returned from tzdb::current_zone() is one that
automatically reloads time zone information as it becomes available
(like the POSIX interfaces on GNU/Linux do).  In other words, there is
no need for reload_tzdb() to do anything in order to update the current
time zone data in a process.

The definition of struct tzdb with its public data members is really
strange.  Is it expected that in order to look up leap seconds,
applications look at leap vector?  Then it is impossible to implement
automatic reloading of leap seconds, which would be disappointing.

Thanks,
Florian



More information about the tz mailing list