Name
SPVM::Time::Local - Reverse Operations of localtime and gmtime.
Description
Time::Local class in SPVM has methods to do reverse operations of localtime and gmtime functions.
Usage
use
Sys;
use
Time::Local;
# timegm
{
my
$epoch
= Sys::Time->
time
;
my
$tm
= Sys->
gmtime
(
$epoch
);
my
$epoch_again
= Time::Local->timegm(
$tm
);
}
# timelocal
{
my
$epoch
= Sys::Time->
time
;
my
$tm_local
= Sys->
localtime
(
$epoch
);
my
$epoch_again
= Time::Local->timelocal(
$tm_local
);
}
Class Methods
timelocal
static method timelocal : long ($tm : Sys::Time::Tm);
Converts a Sys::Time::Tm object to the epoch time.
This method does the reverse operation of the localtime method in the Sys class.
Exceptions:
$tm must be defined. Otherwise an exception is thrown.
timegm
static method timegm : long ($tm : Sys::Time::Tm);
Converts a Sys::Time::Tm object that is UTC
to the epoch time.
This method does the reverse operation of the gmtime method in the Sys class.
Exceptions:
$tm must be defined. Otherwise an exception is thrown.
Repository
Author
Yuki Kimoto kimoto.yuki@gmail.com
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License