JobLog/Time.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 45 CC 1 SCAR 6.9
CC
1
Cov
0%
now
2.0
today
2.0
tz
2.0
CRAP 2.0
1 package App::JobLog::Time;
2 $App::JobLog::Time::VERSION = '1.042';
3 # ABSTRACT: consolidates basic time functions into one location
4  
5  
6 use Exporter 'import';
7 our @EXPORT_OK = qw(
8 now
9 today
10 tz
11 );
12  
13 use Modern::Perl;
14 use DateTime;
15 use DateTime::TimeZone;
16 use App::JobLog::Config qw(_tz);
17  
18 # cached values
19 our ( $today, $now );
20  
21  
22 sub now {
23 $now //= DateTime->now( time_zone => tz() );
24 return $now->clone;
25 }
26  
27  
28 sub today {
29 $today //= now()->truncate( to => 'day' );
30 return $today->clone;
31 }
32  
33  
34 sub tz {
35 _tz;
36 }
37  
38 1;
39  
40 __END__