We need to see the code that you are using to get from your date/time values to the epoch seconds. By my calculations, '31.10.2004 00:40' is 1099179600 - which gives the expected difference of 1200.
Of course, the difference between your answer and the expected answer is one hour, so daylight saving time could be an issue. Which timezone are you in, and when do you change out of daylight saving time? Maybe you could try using 'timegm' instead of 'timelocal' and see what difference that makes.
Here's the code I used.
#!/usr/bin/perl use Time::Local; my $t1 = '31.10.2004 01:00'; my $t2 = '31.10.2004 00:40'; $t1 = time2epoch($t1); $t2 = time2epoch($t2); print "$t1 - $t2 = ", $t1 - $t2, "\n"; sub time2epoch { my $t = shift; my ($d, $m, $y, $H, $M) = split /[\.\s:]/, $t; --$m; $y -= 1900; return timegm 0, $M, $H, $d, $m, $y; }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: timelocal problems
by davorg
in thread timelocal problems
by olecs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |