On 11/3/03 11:26 am, Dave Rolsky at [EMAIL PROTECTED] spake thus:
> Is that acceptable?  I can't think of any good solutions to this, other
> than documenting it.

Bloody stupid idea this daylight-savings crap.


===== My first thought was "How about we compress that hour into nothing?"

    my $dt = DateTime->new( year => 2003, month => 4, day => 5,
                            hour => 2, time_zone => 'America/Chicago',

    my $dt = DateTime->new( year => 2003, month => 4, day => 5,
                            hour => 3, time_zone => 'America/Chicago',

    my $dt = DateTime->new( year => 2003, month => 4, day => 5,
                            hour => 2, minute => 30,
                            time_zone => 'America/Chicago',
Which means
    $dt->add( days => 1 );
would result in getting 3am for all the above.

However it then occurred to me that adding 5 hours to the result would make
it 8am rather than the 7am we expected (and got on every other day of the
year)

===== Then my second thought came:
Why not convert in into a non-existant result .. so:
    my $dt = DateTime->new( year => 2003, month => 4, day => 5,
                            hour => 2, time_zone => 'America/Chicago',
    $dt->add( days => 1 );
would result in getting 2am, but with the DST flag set (which would be the
same as 1am I guess).

Then when we 'add 5 hours' we still get 7am. If we subtract 5 hours we get
10pm without the flag set.

===== Then came the realization that documenting this would be heaps harder
than throwing an exception.

===== However, I don't like the idea of throwing an exception. So could we
maybe compress the missing hour and return 3am for anything between 2am and
2:59?

This means that I have some sort of script that sets triggers at 2am, it
doesn't miss a day or die unexpectedly.


--------------------------------------------------------
             There are 10 kinds of people:
   those that understand binary, and those that don't.
--------------------------------------------------------
   The day Microsoft makes something that doesn't suck
     is the day they start selling vacuum cleaners
--------------------------------------------------------


Reply via email to