Jeremie Klein
and 1 contributors

NAME

App::CamelPKI::Time - Modelise Camel-PKI horatading, up to the second.

SYNOPSIS

  use App::CamelPKI::Time;

  print App::CamelPKI::Time->now();

  my $time = App::CamelPKI::Time->parse("20070412101200Z");
  my $later = $time->advance_days(42);

DESCRIPTION

Objects in the App::CamelPKI::Time class represent an universal timestamp precise to the second. Time zones are not dealt with in this class, and should be handled as an external, view-side attribute instead.

App::CamelPKI::Time objects are immutable and stringifiable: when they are used as strings (for example with print, as shown in the "SYNOPSIS"), they automagically convert themselves into the "Zulu" notation (yyymmddhhmmssZ).

CAPABILITY DISCIPLINE

App::CamelPKI::Time objects are pure data; they do not carry privileges.

CONSTRUCTORS

parse($time)

parse($time, -format => $format)

Parses $time, a string, returns an instance of App::CamelPKI::Time. The default format (and the only one supported for now) is "Zulu".

If no format is specified (and only in this case), $time may be from one of the following special values:

"now"

The return value is then "now";

An object of class App::CamelPKI::Time

A deep copy of this object is returned.

now()

Returns the current system time.

METHODS

zulu()

Returns the time in "Zulu" format. This method is also used as the stringgification operator overload.

advance_days($days)

Returns a copy of this App::CamelPKI::Time object advanced by the specified number of days (which may be negative).

advance_years($years)

Returns a copy of this App::CamelPKI::Time object advanced by the specified number of years, which may be negative.

make_your()

Nothing, actually.