File Coverage

blib/lib/App/JobLog/Time.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition 4 6 66.6
subroutine 8 8 100.0
pod 3 3 100.0
total 35 37 94.5


line stmt bran cond sub pod time code
1             package App::JobLog::Time;
2             $App::JobLog::Time::VERSION = '1.039';
3             # ABSTRACT: consolidates basic time functions into one location
4              
5              
6 6     6   4003 use Exporter 'import';
  6         12  
  6         291  
7             our @EXPORT_OK = qw(
8             now
9             today
10             tz
11             );
12              
13 6     6   32 use Modern::Perl;
  6         12  
  6         43  
14 6     6   2206 use DateTime;
  6         120254  
  6         66  
15 6     6   4557 use DateTime::TimeZone;
  6         121643  
  6         34  
16 6     6   875 use App::JobLog::Config qw(_tz);
  6         12  
  6         1245  
17              
18             # cached values
19             our ( $today, $now );
20              
21              
22             sub now {
23 98   66 98 1 474 $now //= DateTime->now( time_zone => tz() );
24 98         85345 return $now->clone;
25             }
26              
27              
28             sub today {
29 306   66 306 1 998 $today //= now()->truncate( to => 'day' );
30 306         9195 return $today->clone;
31             }
32              
33              
34             sub tz {
35 25810     25810 1 102309 _tz;
36             }
37              
38             1;
39              
40             __END__