in reply to DateTime Daylight savings question

I just finished a debug session, single stepping through your code. I can see no system dependencies, time zone calculations all happen on the Perl level, based on a thing called the Olson Database. So the result cannot be system dependent.

The only thing I can imagine is happening, is that your initial $dt = DateTime->now value is not the same as it is for us, it appears to me (though I'm not absolutely sure) its value can depend on time zone information in the Registry, or in the TZ environment variable. Perhaps you'd better print it out, too, before you set the time zone.

Likely ikegami is right, and your computer's system clock isn't set correctly.

Replies are listed 'Best First'.
Re^2: DateTime Daylight savings question
by Anonymous Monk on Sep 20, 2008 at 00:13 UTC
    ikegami and you are both right! It came to be a rather simple fix, but interesting still.

    Here's what happened. When the last DST patch came along from Windows they did not have one for Win2k (non-paying that is). There was a 3rd party fix, that for whatever reason did not work, after I installed some security updates. I manually disabled the DST setting in my Windows Time, and simply dropped the time down an hour. Hence, the "is Daylight Savings" flag being zero.
    When I turned on the "Daylight Savings" mode checkbox, my system jumps ahead an hour.
    use DateTime; use DateTime::TimeZone; my $dt = DateTime->now; # same as ( epoch => time() ) print( $dt->hms, "\n" ); $dt->set_time_zone( 'America/New_York' ); print( $dt->hms, "\n" ); $dt->set_time_zone( 'EST' ); print( $dt->hms, "\n" ); #Results (With the DST enabled AND disabled..Doesnt matter). 01:10:49 21:10:49 20:10:49
    This is more of a system issue at this point and not a Perl problem, but if anyone has any advice I would be appreciative.
      Download these three files and double-click the .cmd file. That's the patch we used at the office to fix Win2k systems.
      (I was not logged in, I apologize for that last comment" broomduster's code for the timezone was interesting
      When the DST checkbox in Windows was checked it yielded a "1". Don't know if that helps or not.