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

Atsushi Eno atsushi at ximian.com
Tue Sep 6 12:47:26 EDT 2005


>>> 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:

Okk, based on your help, I found some things. The most important one
is that there are different basis of TimeZone: UTC and local time
(there might be other patterns). now I think we need our own
TimeZone data store, that would store timezone names as well.

At least DateTime.ToLocalTime() will be rewritten just to invoke

So, I'll revisit here later. Thanks for all your help, Brion :-)

Atsushi Eno

More information about the Mono-devel-list mailing list