[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] mktime works ?



Hi ,

I try to calculate the time difference in seconds of some time data with
first mktime and then difftime like

#!/usr/bin/perl
use POSIX;

$sec1 = 0;
$min1 = 11;
$hour1 = 10;
$day1 = 1;
$month1 = 0;
$year1 = 99;
$sec2 = 0;
$min2 = 9;
$hour2 = 11;
$day2 = 1;
$month2 = 0;
$year2 = 99;

$secs1 = POSIX::mktime($sec1, $min1, $hour1, $day1, $year1);
$secs2 = POSIX::mktime($sec2, $min2, $hour2, $day2, $year2);
$result = POSIX::difftime($secs1, $secs2);

but the result is always zero. Even the example from the POSIX.pod file
#Calendar time for December 12, 1995, at 10:30 am.
$time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 );
print "Date = ", POSIX::ctime($time_t);
returns:
Date = Fri Jan 1 00:00:00 1904
which seams not very correct.

Any idea?

By
Berndt Wischnewski




===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org