|
NAME"Time::timegm" - a UTC version of "mktime()"SYNOPSISuse Time::timegm qw( timegm ); my $epoch = timegm( 0, 0, 0, 14, 6-1, 2012-1900 ); print "2012-06-14 00:00:00 UTC happened at ", scalar localtime($epoch), " localtime\n"; DESCRIPTIONThe POSIX standard provides three functions for converting between integer epoch values and 6-component "broken-down" time representations. "localtime" and "gmtime" convert an epoch into the 6 components of seconds, minutes, hours, day of month, month and year, in either local timezone or UTC. The "mktime" function converts a local broken-down time into an epoch value. However, "POSIX" does not provide a UTC version of this.This module provides a function "timegm" which has this ability. Unlike some other CPAN implementations of this behaviour, this version does not re-implement the time handling logic internally. It reuses the "mktime" and "gmtime" functions provided by the system to ensure its results are always consistent with the other functions. FUNCTIONS$epoch = timegm( $sec, $min, $hour, $mday, $mon, $year )Returns the epoch integer value representing the time given by the 6 broken-down components.As with "POSIX::mktime" it is not required that these values be within their "valid" ranges. This function will normalise values out of range. For example, the 25th hour of a day is normalised to the 1st hour of the following day; or the 0th month is normalised to the 12th month of the preceeding year. COMPARISON WITH Time::LocalThe Time::Local module also provides a function called "timegm()" with similar behaviour to this one. The differences are:
AUTHORPaul Evans <leonerd@leonerd.org.uk>
Visit the GSP FreeBSD Man Page Interface. |