1Dancer2::Core::Time(3)User Contributed Perl DocumentationDancer2::Core::Time(3)
2
3
4
6 Dancer2::Core::Time - class to handle common helpers for time
7 manipulations
8
10 version 0.400001
11
13 my $time = Dancer2::Core::Time->new( expression => "1h" );
14 $time->seconds; # return 3600
15
17 For consistency, whenever something needs to work with time, it needs
18 to be expressed in seconds, with a timestamp. Although it's very
19 convenient for the machine and calculations, it's not very handy for a
20 human-being, for instance in a configuration file.
21
22 This class provides everything needed to translate any human-
23 understandable expression into a number of seconds.
24
26 seconds
27 Number of seconds represented by the object. Defaults to 0.
28
29 epoch
30 The current epoch to handle. Defaults to seconds + time.
31
32 gmt_string
33 Convert the current value in epoch as a GMT string.
34
35 expression
36 Required. A human readable expression representing the number of
37 seconds to provide.
38
39 The format supported is a number followed by an expression. It
40 currently understands:
41
42 s second seconds sec secs
43 m minute minutes min mins
44 h hr hour hours
45 d day days
46 w week weeks
47 M month months
48 y year years
49
50 Months and years are currently fixed at 30 and 365 days. This may
51 change. Anything else is used verbatim as the expression of a number
52 of seconds.
53
54 Example:
55
56 2 hours, 3 days, 3d, 1 week, 3600, etc...
57
59 Dancer Core Developers
60
62 This software is copyright (c) 2023 by Alexis Sukrieh.
63
64 This is free software; you can redistribute it and/or modify it under
65 the same terms as the Perl 5 programming language system itself.
66
67
68
69perl v5.38.0 2023-07-20 Dancer2::Core::Time(3)