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.

This module is a SPVM class.

Caution

Time::Local is a SPVM class. SPVM itself is yet experimental status.

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

Repository

https://github.com/yuki-kimoto/SPVM-Time-Local

Author

Yuki Kimoto kimoto.yuki@gmail.com

Copyright & License

Copyright 2022-2022 Yuki Kimoto, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.