digitalmars.D.bugs - [Issue 12875] New: [unittest] std.datetime fails: Not a valid tzdata
- via Digitalmars-d-bugs (64/64) Jun 07 2014 https://issues.dlang.org/show_bug.cgi?id=12875
https://issues.dlang.org/show_bug.cgi?id=12875 Issue ID: 12875 Summary: [unittest] std.datetime fails: Not a valid tzdata file. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: Phobos Assignee: nobody puremagic.com Reporter: ibuclaw gdcproject.org Reduced to a test case: --- import std.datetime; import std.exception; import std.stdio; void main() { static void testPZSuccess(string tzName) { scope(failure) writefln("TZName which threw: %s", tzName); TimeZone.getTimeZone(tzName); } auto tzNames = TimeZone.getInstalledTZNames(); foreach(tzName; tzNames) assertNotThrown!DateTimeException(testPZSuccess(tzName)); } --- Throws with the following error: --- TZName which threw: America/Godthab core.exception.AssertError test.d(17): assertNotThrown failed: TimeException was thrown: Not a valid tzdata file. ---------------- 0x44bbcb _enforceValidTZFile ../../../../libphobos/src/std/datetime.d:29854 0x44bbcb immutable(std.datetime.PosixTimeZone) std.datetime.PosixTimeZone.getTimeZone(immutable(char)[], immutable(char)[]) ../../../../libphobos/src/std/datetime.d:29322 0x44c982 immutable(std.datetime.TimeZone) std.datetime.TimeZone.getTimeZone(immutable(char)[]) ../../../../libphobos/src/std/datetime.d:27635 [snip backtrace] --- The line where the assert occurs: --- _enforceValidTZFile(tzFileVersion == '\0' || tzFileVersion == '2'); --- And indeed when testing the file, it is in version '3' format - so I guess not supported. --- $ file /usr/share/zoneinfo/America/Godthab /usr/share/zoneinfo/America/Godthab: timezone data, version 3, 5 gmt time flags, 5 std time flags, no leap seconds, 117 transition times, 5 abbreviation chars --- Here the distribution-specific version of the package tzdata: --- tzdata 2014c-0ubuntu0.14.04 --- --
Jun 07 2014