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

Re: [MacPerl] mktime works ?



At 08.47 -0400 1999.04.20, Berndt Wischnewski wrote:
# I try to calculate the time difference in seconds of some time data with
# first mktime and then difftime like

I'd do this instead:

use Time::Local;
@time1 = (0, 11, 10, 1, 0, 99);
@time2 = (0,  9, 11, 1, 0, 99);

$secs1 = timelocal(@time1);
$secs2 = timelocal(@time2);
print $secs1 - $secs2;

__END__


POSIX::mktime doesn't seem to work right in MacPerl.  But
Time::Local::timelocal() works most of the time on all perls.
POSIX::difftime probably works OK, but I see no reason to use it ... all it
does is subtract one from the other.  In C this is useful because time is
of type time_t, and you can't do general arithmetic with that type.  But in
Perl, we don't have that problem.  :)

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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