[phobos] std.datetime unittest
Martin Nowak
dawg at dawgfoto.de
Tue Jan 3 23:35:56 PST 2012
On Wed, 04 Jan 2012 05:24:18 +0100, Jonathan M Davis <jmdavisProg at gmx.com>
wrote:
> On Wednesday, January 04, 2012 04:55:17 Martin Nowak wrote:
>> I regularly get a failing phobos unittest.
>>
>> core.exception.AssertError at std/datetime.d(28169): _assertPred!"=="
>> failed:
>> [PPT] is not == [PDT].
>>
>> As I am the only one it might be related to updating to FreeBSD9.
>> How can I check that the timezone files are correct?
>> Are there tools to decode timezone files?
>
> Well, the FreeBSD box on the autotester is fine, though I don't know what
> version of FreeBSD it's using. Your failure is just downright bizarre
> though.
> According to
> http://www.timeanddate.com/worldclock/timezone.html?n=137&syear=1925 that
> abbreviation was used for daylight savings time in America/Los_Angeles
> between
> 1925 and 1949. The test tests it for the current time.
>
> The question, therefore, is what time zone your box is set to. It could
> be
> that setTZEnvVar isn't working correctly on your box. However, there
> don't
> appear to be an time zones which currently use PPT for daylight savings
> time,
> so I don't know that it's likely that that's causing the problem.
>
> I suppose that the time zone files _could_ be corrupt, but that seems
> unlikely,
> since it would fail to load if it didn't match the spec. More likely,
> the time
> zone file is just wrong, but that would be weird, since theoretically,
> they all
> come from the same source.
>
> If you want to look at what's in the time zone file, then use zdump. If
> you use
> it with -v, it'll spit out a bunch of lines looking like this:
>
> America/Los_Angeles Sun Mar 8 10:00:00 2493 UTC = Sun Mar 8 03:00:00
> 2493
> PDT isdst=1
>
> Each of them represents a DST switch. On my computer (64-bit Linux), if
> I run
>
> zdump America/Los_Angeles -v | grep PPT
>
> then I get
>
> America/Los_Angeles Tue Aug 14 23:00:00 1945 UTC = Tue Aug 14 16:00:00
> 1945
> PPT isdst=1
> America/Los_Angeles Sun Sep 30 08:59:59 1945 UTC = Sun Sep 30 01:59:59
> 1945
> PPT isdst=1
>
I get about the same, but only if I explicitly specify a year range which
contains these dates.
> If you're seeing more than those two lines, then something is definitely
> wrong
> with your time zone file.
>
> You could also tar up you /usr/share/zoneinfo directory, and I can have
> a look
> at it, but zdump should be enough to tell you whether too many DST
> switches in
> America/Los_Angeles use PPT. And if you're only getting those two lines,
> then
> something else weird is going on that needs to be looked into.
>
I've diffed the distribution tab files with the ones from iana and also
get the
same binaries after zic compiling.
Ah, I can reproduce the same behavior with C so it's likely a bug in
localtime.
Having a short look at the implementation is somewhat revealing :).
http://www.freebsd.org/cgi/cvsweb.cgi/src/contrib/tzcode/stdtime/localtime.c?rev=1.3.2.2.2.1;content-type=text%2Fplain
> - Jonathan M Davis
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
More information about the phobos
mailing list