[Mono-dev] why does DateTime.Now.IsDaylightSavingTime() returns false when it should be true.

Alistair Bush alistair.bush at gmail.com
Mon Oct 28 20:13:50 UTC 2013


Well that certainly sucks.


On Tue, Oct 29, 2013 at 3:03 AM, Robert Jordan <robertj at gmx.net> wrote:

> On 28.10.2013 07:35, Alistair Bush wrote:
>
>> I am trying to figure out why exactly running
>> DateTime.Now.**IsDaylightSavingTIme() returns false.
>> I live in the Auckland/Pacific timezone and pretty much everywhere I
>> look it confirms that yes it is daylight saving time.
>>
>
> Unfortunately, I don't remember the details, but I'm pretty
> sure that ves_icall_System_**CurrentSystemTimeZone_**GetTimeZoneData
> has a bug w/ respect to the Southern Hemisphere.
>
> The code assumes that a year always begins outside a DST zone,
> and this is obviously incorrect for the Southern Hemisphere.
>
> To fix this, the local var "is_daylight" must be properly
> initialized. Currently, it's always 0 at start, but it must
> be initialized with 1 when January, 1st is inside a DST
> zone.
>
> Maybe this:
>
>         is_daylight = start.tm_isdst > 0;
>
> just before
>
>         /* For each day of the year, calculate the tm_gmtoff. */
>         for (day = 0; day < 365; day++) {
>
> Robert
>
>
> ______________________________**_________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.**com <Mono-devel-list at lists.ximian.com>
> http://lists.ximian.com/**mailman/listinfo/mono-devel-**list<http://lists.ximian.com/mailman/listinfo/mono-devel-list>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20131029/49e19bb2/attachment-0001.html>


More information about the Mono-devel-list mailing list