Because your -5 hours off of epoch time - i.e.:
my ($secs, $mins, $hours, $mday,  $mon, $year, undef, undef, undef) =
localtime($endTime - $startTime);
print "Elapsed time was $mon/$mday/$year - $hours:$mins:$secs\n";
 
gives:
Elapsed time was 11/31/69 - 18:0:10
That is plus 10 seconds minus (in my case) 6 hours from the epoch (1/1/70) gives us a time of Dec 31, 1969 18:00:10 (month as '11' is uncorrected for the zero based month numbers of localtime() - see perldoc -f localtime)
 
Try:
my $diff_time = $endTime - $startTime;
printf("Elapsed time was %.02f seconds\n", $diff_time);
printf("Elapsed time was %.02f minutes\n", $diff_time/60);
printf("Elapsed time was %.04f hours\n", $diff_time/(60*60));
printf("Elapsed time was %.04f days\n", $diff_time/(24*60*60));
 
a


Andy Bach, Sys. Mangler
Internet: [EMAIL PROTECTED]    
VOICE: (608) 261-5738  FAX 264-5932

Why do programmers confuse Halloween and Christmas?
Because OCT 31 = DEC 25.
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to