[tz] Getting current tzdb version in use

Howard Hinnant howard.hinnant at gmail.com
Thu Jul 19 01:45:14 UTC 2018


On Jul 18, 2018, at 9:36 PM, Aldrin Martoq Ahumada <aldrin.martoq at gmail.com> wrote:
> 
> Hi,
> 
> I was looking for a reliable way to get the current tzdb version (something like 2018e), but it seems it doesn’t exists yet. A couple of examples:
> - In Mac OS 10.13.6, there is a /usr/share/zoneinfo/+VERSION that says 2018c.
> - In one of my updated Ubuntu 16.04 servers, the only reliable way is to do a dpkg -s tzdata | grep ^Version, and guess the real version from the string “Version: 2017c-0ubuntu0.16.04"
> - The “tzinfo” ruby library can get the version only if it uses its own version of tzdata, if it uses the OS files, there is no string version.
> 
> Knowing the current tzdb version is essential for automating timezone updates.
> 
> 
> I think an appropriate place to put that string is in the binary TZif file itself, so tools like tzinfo can get the current version *of the current timezone in use*, instead of looking some random file like +VERSION in a random directory/folder.
> 
> Is there any chances for this to happen? Or any other suggestion?

Fwiw, in the draft C++20 spec, this is a legal program that prints out what you want:

    #include <chrono>
    #include <iostream>

    int
    main()
    {
        std::cout << std::chrono::get_tzdb().version << '\n';
    }

Howard

-------------- 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/20180718/fcdc1012/attachment.sig>


More information about the tz mailing list