In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (John Bruin) writes:
>> From: Bob Showalter [mailto:[EMAIL PROTECTED]
>> If you switch from daylight savings time at 2am on Sunday,
>> October 31, then the difference between the local times of
>> noon on Saturday the 30th and noon on Sunday the 31st is 25
>> hours, not 24 hours. If you're expecting it to be
>> 24 hours, that's not correct.
>
>Yes this is exactly what I am try to do. I am working out how long jobs take
>to complete and I need 1 day to equal 24 hrs and a week to equal 168 hrs
>regardless of daylight saving change overs. We used to use a spreadsheet for
>this calculation and that's what we're trying to duplicate. Technically
>inaccurate yes but for our purposes it gives the expected result.
Okay, well then you can either lie about whether you're in a daylight
saving time zone:
% perl -MDate::Parse -le 'print str2time("Sun Oct 31 01:00:00 PST 2004") \
- str2time("Sat Oct 30 23:00:00 PST 2004")'
7200
vs. what you don't want:
% perl -MDate::Parse -le 'print str2time("Sun Oct 31 01:00:00 PST 2004") \
- str2time("Sat Oct 30 23:00:00 PDT 2004")'
10800
Or you can just make the timezone the never-changing GMT:
% perl -MDate::Parse -le 'print str2time("Sun Oct 31 01:00:00 GMT 2004") \
- str2time("Sat Oct 30 23:00:00 GMT 2004")'
7200
--
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>