[Mono-dev] Time zone problems with DateTime.Parse (patch and bug)

Brion Vibber brion at pobox.com
Tue Sep 6 03:56:14 EDT 2005


Atsushi Eno wrote:
>> Test case and patch for that:
>> http://bugzilla.ximian.com/show_bug.cgi?id=75995
>
> Looks good. I'll commit your patch later when I converted the tests
> to NUnit tests.

Thanks!

>> Test case:
>> http://bugzilla.ximian.com/show_bug.cgi?id=75985
>>
>> I think the problem here is that the internal DateTime(bool,long)
>> constructor calls tz.GetUtcOffset(this) with the UTC time to get the
>> timezone offset before applying it to get local time, but that function
>> expects a local time to determine if DST is active. A bit of a
>> chicken-and-egg problem, perhaps... ;)
>
>
> Agreed. But it seems possible to avoid that problem. Can you please
> try attached patch? I don't have sane Unix environment and I'm
> not in such region that has summer time ;-) It would be even nicer
> if you try the entire corlib Nunit tests as well.

Cool, that's definitely closer! Unfortunately it's still a bit off;
during the doubled hour in the DST transition it's an hour off in the
wrong direction. Using output from my test proggy on that bug:

On .NET 1.1, two UTC times are correctly mapped to 1:50 AM. (The second
hour can't be mapped back to its original UTC time, but that's life.)

In PDT/PST transition, 1-2am happens twice
2003-10-26T08:50:47Z == 2003-10-26T08:50:47Z (via local 10/26/2003
1:50:47 AM
2003-10-26T09:50:47Z != 2003-10-26T08:50:47Z (via local 10/26/2003
1:50:47 AM
2003-10-26T10:50:47Z == 2003-10-26T10:50:47Z (via local 10/26/2003
2:50:47 AM

Mono w/ patch on Linux: the second 1:50 is mismapped to 2:50 AM:

In PDT/PST transition, 1-2am happens twice
2003-10-26T08:50:47Z == 2003-10-26T08:50:47Z (via local 10/26/2003
1:50:47 AM
2003-10-26T09:50:47Z != 2003-10-26T10:50:47Z (via local 10/26/2003
2:50:47 AM
2003-10-26T10:50:47Z == 2003-10-26T10:50:47Z (via local 10/26/2003
2:50:47 AM

Man, I hate daylight saving time more and more...

-- brion vibber (brion @ pobox.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050906/6a9e579b/attachment.bin 


More information about the Mono-devel-list mailing list