[tz] Welcome to the "tz" mailing list

Brian Inglis Brian.Inglis at SystematicSw.ab.ca
Thu May 21 16:18:41 UTC 2020


On 2020-05-21 07:09, Michael H Deckers via tz wrote:
> 
>    On 2020-05-21 12:39, Sundar Sarma wrote:
> 
> 
>> Still i did not understand why this test case is failing with new 2020a tz.
> 
> 
>    The version of the IANA database installed in the operating
>    system may well differ from the version used by Java.time.
>    The latter can be determined with the method
>         ZoneRulesProvider.getVersions​( String zoneId ).
>    which gives the version used by Java.

>From Google and SO, with recent versions, you can do:

$ jshell <<< \
'System.out.println(java.time.zone.ZoneRulesProvider.getVersions("UTC").keySet());'
|  Welcome to JShell -- Version 11.0.7
|  For an introduction type: /help intro

jshell>
System.out.println(java.time.zone.ZoneRulesProvider.getVersions("UTC").keySet());
[2019c]

jshell> $

*OR*

$ grep -ao '^...TZDB....[12][90][0-9][0-9][a-z]' /usr/lib/jvm/*/lib/tzdb.dat
/usr/lib/jvm/java-1.11.0-openjdk-i386/lib/tzdb.dat:TZDB2019c
/usr/lib/jvm/java-11-openjdk-i386/lib/tzdb.dat:TZDB2019c

what is actually matched is:

$ grep -ao '^...TZDB....[12][90][0-9][0-9][a-z]' /usr/lib/jvm/*/lib/tzdb.dat |
cat -A
/usr/lib/jvm/java-1.11.0-openjdk-i386/lib/tzdb.dat:^A^@^DTZDB^@^A^@^E2019c$
/usr/lib/jvm/java-11-openjdk-i386/lib/tzdb.dat:^A^@^DTZDB^@^A^@^E2019c$

so there's a code and a byte count and some zeros or nulls, so you could dump
just those:

$ for dat in /usr/lib/jvm/*/lib/tzdb.dat
  do
    echo $dat:
    head -n1 $dat | cut -c12-16
  done
/usr/lib/jvm/java-1.11.0-openjdk-i386/lib/tzdb.dat:
2019c
/usr/lib/jvm/java-11-openjdk-i386/lib/tzdb.dat:
2019c

*OR*

equivalents on other systems e.g. for Oracle it should be something like:

$ grep -ao '^javazm.....tzdata[12][90][0-9][0-9][a-z]' \
		$JAVA_HOME/jre/lib/zi/ZoneInfoMappings

*OR*

$ head -n1 $JAVA_HOME/jre/lib/zi/ZoneInfoMappings | cut -c18-22

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in IEC units and prefixes, physical quantities in SI.]


More information about the tz mailing list