++ed by:
XYF POTATOGIM FAYLAND YOUPONG MHOWARD
10 non-PAUSE users
Author image Yuki Kimoto

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);
  

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);

See Also

See Time::Local about timelocal and timegm methods.