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

Re: [MacPerl] time problems



pittelli@ehsct7.envmed.rochester.edu writes:
}I can't get time-conversion to work properly on a client's machine:
}MacPerl5, MacOS 7.5 (non-powerPC).
}
}If I do a timelocal() on localtime(), the return seconds is not only off
}by a HUGE number (initially need to set $date_correct = -14230008800 to
}get the two times below to agree), but the deviation diverges with time!
}
}It's important that I can do the double-conversion as below (so I can
}compare NOW seconds with an 'unknown' date/time seconds):

Try this:

#!perl
$date_correct = 0;
use Time::Local;

@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";

}
}Does anyone know whether this is typical for a Mac and whether this
}problem is fixed in any particular (preferably 5.001+) build?
}(could someone PLEASE run this on their system?)

The problem is due to integer bugs in 5.002.  They should be fixed in
5.004.  Matthias has fixed the new Time::Local to avoid integer
comparisons, but not timelocal.pl.  You should just use Time::Local.

}
}At present, I don't know the exact build (not familiar with Mac Perl
}enough to tell the client how to get specific build over the phone), but
}I could find out with some help...REALLY just want to know what build
}this works on!
}
}-Randy
}
}
}--
}<----------------------------------------->
}| Randal Pittelli                         |
}| Dept of Environmental Medicine          |
}| Univ of Rochester Medical Center        |
}| Rochester, NY 14642                     |
}|                                         |
}| TEL: (716) 275-0797                     |
}| FAX: (716) 256-2591                     |
}| pittelli@envmed.rochester.edu           |
}| http://www.envmed.rochester.edu/wwwrlp/ |
}| --------------------------------------- |
}|  "Love only a god that dances" - F.N.   |
}<----------------------------------------->

---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



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