line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::JobLog::Time; |
2
|
|
|
|
|
|
|
$App::JobLog::Time::VERSION = '1.041'; |
3
|
|
|
|
|
|
|
# ABSTRACT: consolidates basic time functions into one location |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
3737
|
use Exporter 'import'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
291
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
8
|
|
|
|
|
|
|
now |
9
|
|
|
|
|
|
|
today |
10
|
|
|
|
|
|
|
tz |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
33
|
use Modern::Perl; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
43
|
|
14
|
6
|
|
|
6
|
|
2105
|
use DateTime; |
|
6
|
|
|
|
|
122062
|
|
|
6
|
|
|
|
|
70
|
|
15
|
6
|
|
|
6
|
|
4328
|
use DateTime::TimeZone; |
|
6
|
|
|
|
|
119290
|
|
|
6
|
|
|
|
|
34
|
|
16
|
6
|
|
|
6
|
|
859
|
use App::JobLog::Config qw(_tz); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
1189
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# cached values |
19
|
|
|
|
|
|
|
our ( $today, $now ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub now { |
23
|
98
|
|
66
|
98
|
1
|
470
|
$now //= DateTime->now( time_zone => tz() ); |
24
|
98
|
|
|
|
|
85671
|
return $now->clone; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub today { |
29
|
306
|
|
66
|
306
|
1
|
1093
|
$today //= now()->truncate( to => 'day' ); |
30
|
306
|
|
|
|
|
9237
|
return $today->clone; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub tz { |
35
|
25810
|
|
|
25810
|
1
|
101619
|
_tz; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |