tags:

views:

20

answers:

1

Here's the code:

$ical = Date::ICal->new( year => 1964, month => 10, day => 16, 
                             hour => 20, min => 12, sec => 47, 
                             #tz => '0530' 
                        );

ok( defined $ical,            'new() returned something' );
ok( $ical->isa('Date::ICal'), "  and it's the right class" );

is( $ical->sec,     47,       '  sec()'   );
is( $ical->min,     12,       '  min()'   );    
is( $ical->hour,    20,       '  hour()'  );
is( $ical->day,     16,       '  day()'   );
is( $ical->month,   10,       '  month()' );
is( $ical->year,    1964,     '  year()'  );

print "hour = " . $ical->hour . "\n";

and here's the output:

1..8
ok 1 - new() returned something
ok 2 -   and it's the right class
ok 3 -   sec()
ok 4 -   min()
not ok 5 -   hour()
#   Failed test '  hour()'
#   at ./test_more.pl line 17.
#          got: '0'
#     expected: '20'
not ok 6 -   day()
#   Failed test '  day()'
#   at ./test_more.pl line 18.
#          got: '17'
#     expected: '16'
ok 7 -   month()
ok 8 -   year()
hour = 0
# Looks like you failed 2 tests of 8.

what gives ????

+1  A: 

Is it a time zone issue? Are you exactly 4 hours behind UTC?

mobrule
I'm actually 5 hours behind, but shouldn't I get the hours back in my tz if its not specified? (which is why a commented out the tz attribute)
ennuikiller
Were you 4 hours behind UTC as of 10/16/1964?
mobrule
good question, yes in fact I guess I was......
ennuikiller
so now the question is how do I specify the tz attribute to get the hour returned in my timezone?
ennuikiller
well just answered my own question: setting TZ to '-4:00' solved the problem.
ennuikiller