[tz] Getting current tzdb version in use

Martin Burnicki martin.burnicki at meinberg.de
Thu Jul 19 07:33:41 UTC 2018


Howard Hinnant wrote:
> The C++20 draft specification leaves the version unspecified, both in its content and its source.  However it is expected that the implementor will make a best attempt to track the IANA database version number.
> 
> The prototype implementation first tries the file “version”.  If that file doesn’t exist, it tries to scrape the version number out of NEWS:
> 
>     https://github.com/HowardHinnant/date/blob/master/src/tz.cpp#L3316-L3342
> 
> On Apple OS's, and if using the OS-supplied zic-compiled files, “+VERSION” is used:
> 
>     https://github.com/HowardHinnant/date/blob/master/src/tz.cpp#L2618-L2632
> 
> std::lib implementors will be free to provide this information however they best see fit to serve their customers.  Some implementors will probably initially provide an empty string as the version, and my hope is that they will be down-voted in market share.  In time, I hope that C++ std::lib implementors will converge on supplying an accurate representation of the IANA version number, given the standard API for doing so.  Customers will have this standard API in their toolbox, and provide market pressure to their vendors for said API to supply quality results.

So the *implementation* of this feature in the lib would also be easier
if tzdb provided a standard way to get the version.

BTW, does your implementation check the tzdb version on each call, or
only once after startup? In the latter case an updated tzdb version
would only be detected if a program (or the whole system) is restarted ...

Martin



More information about the tz mailing list