The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SPVM::Time::Local - Reverse Manipulation of localtime and gmtime Functions.

SYNOPSYS

  use Time
  use Time::Local;

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

DESCRIPTION

Time::Local provides reverse manipulations of localtime and gmtime functions.

CLASS METHODS

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 reverse manipulation of localtime.

This method is the same as timelocal function of Linux.

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

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 reverse manipulation of gmtime.

This method is the same as timegm function of Linux.

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