[tz] Getting current tzdb version in use

Howard Hinnant howard.hinnant at gmail.com
Thu Jul 19 12:36:55 UTC 2018

On Jul 19, 2018, at 3:33 AM, Martin Burnicki <martin.burnicki at meinberg.de> wrote:
> 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 …

On first access to any call that requires a tzdb lookup, the version is looked up on the local disk and cached.

However, if the client calls reload_tzdb() (https://en.cppreference.com/w/cpp/chrono/tzdb_functions) the std::lib implementation may load a new version of the tzdb if available.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mm.icann.org/pipermail/tz/attachments/20180719/602cbfa1/signature.asc>

More information about the tz mailing list