>
> I ran all of your examples and the times always agree between DateTime
> and POSIX on my system.


Yeah, that might to do with TZ settings on your machine.


> So I would think the question should be, for your
> timezone which result is correct, POSIX or DateTime?
>

That was my question exactly, who decides on what is correct.


my $dt = DateTime->new(day => 4, month => 10, year => 2008, hour => 2,
time_zone => "Australia/Melbourne");

* Rick's comment on $dt->add(days => 1) barfing makes sense because DateTime
thinks you want 2008-10-05 0200 AEST which is invalid.

* The main issue I had was with $dt->add(hours => 24) giving me 2008-10-05
0300 while POSIX::mktime gives me 2008-10-05 0200.

* I just tripped on something else too, POSIX::mktime behavior is different
in debian linux and FreeBSD. I'm fairly certain that both have been
patched/updated recently.

$uname -a
FreeBSD chamois4 4.8-RELEASE-p17 FreeBSD 4.8-RELEASE-p17 #1: Mon Apr 18
11:34:52 EST 2005
$perl -MPOSIX -le 'print scalar localtime mktime(0,0,2+24,4,9,108,0,0,-1)'
Thu Jan  1 10:00:00 1970

$uname -a
Linux korma 2.6.26-bpo.1-amd64 #1 SMP Mon Aug 25 13:40:55 UTC 2008 x86_64
GNU/Linux
$perl -MPOSIX -le 'print scalar localtime mktime(0,0,2+24,4,9,108,0,0,-1)'
Sun Oct  5 03:00:00 2008

atleast DateTime is consistent on both machines giving me "Sun Oct  5
03:00:00 2008" :-)

Rick, what are your thoughts ?

Reply via email to