[tz] Getting current tzdb version in use
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:
>> On Apple OS's, and if using the OS-supplied zic-compiled files, “+VERSION” is used:
>> 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...
Size: 833 bytes
Desc: Message signed with OpenPGP
More information about the tz