06 Jun 2021 17:32:08 UTC
- Distribution: Dancer2
- Module version: 0.301004
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Issues (122)
- Testers (790 / 3 / 0)
- KwaliteeBus factor: 3
- 84.81% Coverage
- License: perl_5
- Activity24 month
- Download (391.12KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:78 non-PAUSE usersCROMEDOME Jason A. Cromeand 1 contributors
- Dancer Core Developers
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- COPYRIGHT AND LICENSE
Dancer2::Core::Time - class to handle common helpers for time manipulations
my $time = Dancer2::Core::Time->new( expression => "1h" ); $time->seconds; # return 3600
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.
Number of seconds represented by the object. Defaults to 0.
The current epoch to handle. Defaults to seconds + time.
Convert the current value in epoch as a GMT string.
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.
2 hours, 3 days, 3d, 1 week, 3600, etc...
Dancer Core Developers
This software is copyright (c) 2021 by Alexis Sukrieh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.