NAME

SPVM::Time - Time Manipulation

SYNOPSYS

use Time;

# Get the current epoch time
my $epoch = Time->time;

# Convert a epoch time to the Time::Info object that is local time
my $time_info_local = Time->localtime($epoch);

# Convert a epoch time to the Time::Info object that is UTC
my $time_info_utc = Time->gmtime($epoch);

# Convert a Time::Info object that is local time to the epoch time
my $epoch = Time->timelocal($time_info_local);

# Convert a Time::Info object that is UTC to the epoch time
my $epoch = Time->timegm($time_info_utc);

DESCRIPTION

Time is a module to manipulate time.

CLASS METHODS

time

static method time : long ()

Get the current epoch time.

This method is the same as time function of Linux.

my $epoch = Time->time;

localtime

static method localtime : Time::Info ($time : long)

Convert an epoch time to the Time::Info object that is local time.

This method is the same as localtime function of Linux.

my $time_info = Time->localtime($epoch);

gmtime

static method gmtime : Time::Info ($time : long)

Convert an epoch time to the Time::Info object that is UTC.

This method is the same as gmtime function of Linux.

my $time_info = Time->gmtime($epoch);

timelocal

static method timelocal : long ($time_info : Time::Info)

Convert a Time::Info object that is local time to the epoch time.

This method is the same as timelocal function of Linux.

my $epoch = Time::Local->timelocal($time_info);

timegm

static method timegm : long ($time_info : Time::Info)

Convert a Time::Info object that is UTC to the epoch time.

This method is the same as timegm function of Linux.

my $epoch = Time::Local->timegm($time_info);