32.44. Time::Local
This prints:
The Time::Local module provides two functions, timelocal and
timegm, that work like inverse functions for the standard
localtime and gmtime functions, respectively. That is, they take
a list of numeric values for the various components of what
localtime returns in list context and figure out what input to
localtime would produce those values. You might do this if you
wanted to compare or run calculations on two different dates. Although these are not general-purpose functions for parsing dates and
times, if you can arrange to have your input in the right format, they
often suffice. As you can see from the example above, however, time
has its oddities, and even simple calculations often fail to do the job
intended due to leap years, leap seconds, and the phase of the moon.
Two large but fully featured CPAN modules address these issues and
more: Date::Calc and Date::Manip.
![]() Copyright © 2001 O'Reilly & Associates. All rights reserved. |
|