App/Chart/Timebase/Days.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« App/Chart/Gtk2/Job.pm ↑ Summary App/Chart/Database.pm »
1 # Copyright 2007, 2008, 2009 Kevin Ryde
2  
3 # This file is part of Chart.
4 #
5 # Chart is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 3, or (at your option) any later version.
8 #
9 # Chart is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 # details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with Chart. If not, see <http://www.gnu.org/licenses/>.
16  
17  
18 package App::Chart::Timebase::Days;
19 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Locale::TextDomain ('App-Chart');
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 0 ▶use App::Chart;
Subroutine BEGIN: called CC=1 SCAR=2.6
24 use base 'App::Chart::Timebase';
25  
26 sub new_from_ymd {
27 my ($class, $year, $month, $day) = @_;
28 return $class->SUPER::new
29 (base => App::Chart::ymd_to_tdate_floor ($year, $month, $day));
30 }
31  
32 sub to_ymd {
33 my ($self, $t) = @_;
34 return App::Chart::tdate_to_ymd ($t + $self->{'base'});
35 }
36  
37 sub from_ymd_floor {
38 my ($self, $year, $month, $day) = @_;
39 return App::Chart::ymd_to_tdate_floor ($year, $month, $day)
40 - $self->{'base'};
41 }
42  
43 sub from_ymd_ceil {
44 my ($self, $year, $month, $day) = @_;
45 return App::Chart::ymd_to_tdate_ceil ($year, $month, $day)
46 - $self->{'base'};
47 }
48  
49 sub adjective { return __('Daily'); }
50  
51 1;
« App/Chart/Gtk2/Job.pm ↑ Summary App/Chart/Database.pm »