Dancer2::Core::Time(3pm)

Dancer2::Core::Time3pm

Class to handle common helpers for time manipulations

Usage

    my $time = Dancer2::Core::Time->new( expression => "1h" );
    $time->seconds; # return 3600

Version

version 1.1.2

Overview

For consistency, whenever something needs to work with time, it needs to be expressed in seconds, with a timestamp. Although it's very convenient for the machine and calculations, it's not very handy for a human-being, for instance in a configuration file.

This class provides everything needed to translate any human-understandable expression into a number of seconds.

Attributes

seconds

Number of seconds represented by the object. Defaults to 0.

epoch

The current epoch to handle. Defaults to seconds + time.

gmt_string

Convert the current value in epoch as a GMT string.

expression

Required. A human readable expression representing the number of seconds to provide.

The format supported is a number followed by an expression. It currently understands:

    s second seconds sec secs
    m minute minutes min mins
    h hr hour hours
    d day days
    w week weeks
    M month months
    y year years

Months and years are currently fixed at 30 and 365 days. This may change. Anything else is used verbatim as the expression of a number of seconds.

Example:

    2 hours, 3 days, 3d, 1 week, 3600, etc...

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

Author

Dancer Core Developers

From libdancer2-perl 1.1.2+dfsg-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.