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

Re: [MacPerl] time problems



At 19.52 6/23/97, Randal Pittelli wrote:
>$date_correct = 0;
>require "timelocal.pl";
>
>@now=localtime();
>$testsec=&timelocal(@now) + $date_correct;
>@t=localtime($testsec);
>$n = "$now[4]/$now[3]/$now[5] $now[2]:$now[1]:$now[0]";
>$r = "$t[4]/$t[3]/$t[5] $t[2]:$t[1]:$t[0]";
>
>print "NOW TIME: $n\n";
>print "RET TIME: $r\n";

Simply replace

        require "timelocal.pl";

with

        use Time::Local;


Former produced:
NOW TIME: 5/23/97 22:57:12
RET TIME: 0/1/4 0:0:0

Latter produced:
NOW TIME: 5/23/97 22:57:14
RET TIME: 5/23/97 22:57:14

Time::Local exports the timelocal() method, so you don't have to change
anything else.

--
Chris Nandor                 pudge@pobox.com                 http://pudge.net/
%PGPKey=('B76E72AD',[1024,'08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6'])



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch