[tz] Getting current tzdb version in use

John Haxby john.haxby at oracle.com
Thu Jul 19 15:27:05 UTC 2018



> On 19 Jul 2018, at 15:51, Paul Eggert <eggert at cs.ucla.edu> wrote:
> 
> Martin Burnicki wrote:
>> So the*implementation*  of this feature in the lib would also be easier
>> if tzdb provided a standard way to get the version.
> 
> /usr/share/zoneinfo/tzdata.zi contains a "# version" line. Though this is reasonably recent in tzdb, and many distributions don't install that file, and it's not part of the stable API.
> 
> I have my doubts about the version info. Many distributions apply local changes to their tzdb data, and I expect that they're not updating the version line appropriately. So all you have is some sort of vague good-faith attempt at version info; it doesn't guarantee that you have a particular tzdb release. That is, the version info is not something that a portable program should rely on; all it's really good for is as a string that the program can report to the user so that the user can try to debug whatever goes wrong.

Fedora, RHEL6/CentOS6/OL6 and RHEL7/CentOS7/OL7 have good news and bad news.

The good news is that /usr/share/zoneinfo/tzdata.zi exists.

The bad news is that it says "# version unknown".  The "tzdata.zi" file is, in fact, a recent addition, it seems to have been added in tzdata-2018e-3 so perhaps the version will get fixed in a future version.  Even so, as you say, local changes may be reflected in the version recorded in tzdata.zi so software relying on that version is going to have to guess whether or not it is up to date.

Perhaps the C++ tzdata-version thing is looking forward to a time when there's a standardised version from tzdist.

jch


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


More information about the tz mailing list