| 1 | package Time::Moment::Adjusters; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp qw[]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '0.46'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | our @EXPORT_OK = qw[ NextDayOfWeek | |||||||||||||||||||||||||||||||||||||||||
| 10 | NextOrSameDayOfWeek | ||||||||||||||||||||||||||||||||||||||||||
| 11 | PreviousDayOfWeek | ||||||||||||||||||||||||||||||||||||||||||
| 12 | PreviousOrSameDayOfWeek | ||||||||||||||||||||||||||||||||||||||||||
| 13 | NearestDayOfWeek | ||||||||||||||||||||||||||||||||||||||||||
| 14 | FirstDayOfWeekInMonth | ||||||||||||||||||||||||||||||||||||||||||
| 15 | LastDayOfWeekInMonth | ||||||||||||||||||||||||||||||||||||||||||
| 16 | NthDayOfWeekInMonth | ||||||||||||||||||||||||||||||||||||||||||
| 17 | WesternEasterSunday | ||||||||||||||||||||||||||||||||||||||||||
| 18 | OrthodoxEasterSunday | ||||||||||||||||||||||||||||||||||||||||||
| 19 | NearestMinuteInterval ]; | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||||||||||||||||
| 22 | all => [ @EXPORT_OK ], | ||||||||||||||||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | *import = \&Exporter::import; | |||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 49 | ▶ | sub NextDayOfWeek { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
NextDayOfWeek: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 49 | ▶ | @_ == 1 or Carp::croak(q<Usage: NextDayOfWeek(day)>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 49 | my ($day) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 49 | ▶ | ($day >= 1 && $day <= 7) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$day >= 1 and $day <= 7
MC/DC0%0/2
$day >= 1 and $day <= 7
$day >= 1
$day <= 7
Truth table33%1/3
A and B
A= $day >= 1B= $day <= 7
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | or Carp::croak(q<Parameter 'day' is out of the range [1, 7]>); | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 49 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 49 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 49 | return $tm->plus_days(($day - $tm->day_of_week + 6) % 7 + 1); | |||||||||||||||||||||||||||||||||||||||||
| 39 | 49 | }; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 49 | ▶ | sub NextOrSameDayOfWeek { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
NextOrSameDayOfWeek: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 49 | ▶ | @_ == 1 or Carp::croak(q<Usage: NextOrSameDayOfWeek(day)>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 49 | my ($day) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 49 | ▶ | ($day >= 1 && $day <= 7) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$day >= 1 and $day <= 7
MC/DC0%0/2
$day >= 1 and $day <= 7
$day >= 1
$day <= 7
Truth table33%1/3
A and B
A= $day >= 1B= $day <= 7
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | or Carp::croak(q<Parameter 'day' is out of the range [1, 7]>); | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 49 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 49 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 49 | return $tm->plus_days(($day - $tm->day_of_week) % 7); | |||||||||||||||||||||||||||||||||||||||||
| 52 | 49 | }; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 49 | ▶ | sub PreviousDayOfWeek { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PreviousDayOfWeek: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 49 | ▶ | @_ == 1 or Carp::croak(q<Usage: PreviousDayOfWeek(day)>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 49 | my ($day) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 49 | ▶ | ($day >= 1 && $day <= 7) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$day >= 1 and $day <= 7
MC/DC0%0/2
$day >= 1 and $day <= 7
$day >= 1
$day <= 7
Truth table33%1/3
A and B
A= $day >= 1B= $day <= 7
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | or Carp::croak(q<Parameter 'day' is out of the range [1, 7]>); | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 49 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 49 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 49 | return $tm->minus_days(($tm->day_of_week - $day + 6) % 7 + 1); | |||||||||||||||||||||||||||||||||||||||||
| 65 | 49 | }; | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 49 | ▶ | sub PreviousOrSameDayOfWeek { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PreviousOrSameDayOfWeek: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 49 | ▶ | @_ == 1 or Carp::croak(q<Usage: PreviousOrSameDayOfWeek(day)>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 49 | my ($day) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 49 | ▶ | ($day >= 1 && $day <= 7) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$day >= 1 and $day <= 7
MC/DC0%0/2
$day >= 1 and $day <= 7
$day >= 1
$day <= 7
Truth table33%1/3
A and B
A= $day >= 1B= $day <= 7
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | or Carp::croak(q<Parameter 'day' is out of the range [1, 7]>); | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 49 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 49 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 49 | return $tm->minus_days(($tm->day_of_week - $day) % 7); | |||||||||||||||||||||||||||||||||||||||||
| 78 | 49 | }; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 9 | ▶ | sub NearestDayOfWeek { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
NearestDayOfWeek: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 9 | ▶ | @_ == 1 or Carp::croak(q<Usage: NearestDayOfWeek(day)>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 9 | my ($day) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 9 | ▶ | ($day >= 1 && $day <= 7) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$day >= 1 and $day <= 7
MC/DC0%0/2
$day >= 1 and $day <= 7
$day >= 1
$day <= 7
Truth table33%1/3
A and B
A= $day >= 1B= $day <= 7
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | or Carp::croak(q<Parameter 'day' is out of the range [1, 7]>); | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 9 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 9 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 9 | return $tm->plus_days((($day - $tm->day_of_week + 3) % 7) - 3); | |||||||||||||||||||||||||||||||||||||||||
| 91 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 2562 | ▶ | sub FirstDayOfWeekInMonth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FirstDayOfWeekInMonth: called CC=4 SCAR=14.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 2562 | ▶ | @_ == 1 or Carp::croak(q<Usage: FirstDayOfWeekInMonth(day)>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 2562 | my ($day) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 2562 | ▶ | ($day >= 1 && $day <= 7) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$day >= 1 and $day <= 7
MC/DC0%0/2
$day >= 1 and $day <= 7
$day >= 1
$day <= 7
Truth table33%1/3
A and B
A= $day >= 1B= $day <= 7
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | or Carp::croak(q<Parameter 'day' is out of the range [1, 7]>); | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 2562 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 2562 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 2562 | $tm = $tm->with_day_of_month(1); | |||||||||||||||||||||||||||||||||||||||||
| 104 | 2562 | return $tm->plus_days(($day - $tm->day_of_week) % 7); | |||||||||||||||||||||||||||||||||||||||||
| 105 | 2562 | }; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 2562 | ▶ | sub LastDayOfWeekInMonth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LastDayOfWeekInMonth: called CC=4 SCAR=14.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 2562 | ▶ | @_ == 1 or Carp::croak(q<Usage: LastDayOfWeekInMonth(day)>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 2562 | my ($day) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 2562 | ▶ | ($day >= 1 && $day <= 7) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$day >= 1 and $day <= 7
MC/DC0%0/2
$day >= 1 and $day <= 7
$day >= 1
$day <= 7
Truth table33%1/3
A and B
A= $day >= 1B= $day <= 7
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | or Carp::croak(q<Parameter 'day' is out of the range [1, 7]>); | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 2562 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 2562 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 2562 | $tm = $tm->at_last_day_of_month; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 2562 | return $tm->minus_days(($tm->day_of_week - $day) % 7); | |||||||||||||||||||||||||||||||||||||||||
| 119 | 2562 | }; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 672 | ▶ | sub NthDayOfWeekInMonth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
NthDayOfWeekInMonth: called CC=8 SCAR=22.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 672 | ▶ | @_ == 2 or Carp::croak(q<Usage: NthDayOfWeekInMonth(ordinal, day)>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 672 | my ($ordinal, $day) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 672 | ▶ | ($ordinal >= -4 && $ordinal <= 4 && $ordinal != 0) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$ordinal >= -4 and $ordinal <= 4 and $ordinal != 0
$ordinal >= -4 and $ordinal <= 4
MC/DC0%0/3
$ordinal >= -4 and $ordinal <= 4 and $ordinal != 0
$ordinal >= -4
$ordinal <= 4
$ordinal != 0
Truth table25%1/4
A and B and C
A= $ordinal >= -4B= $ordinal <= 4C= $ordinal != 0
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | or Carp::croak(q<Parameter 'ordinal' is out of the range [-4, -1] u [1, 4]>); | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 672 | ▶ | ($day >= 1 && $day <= 7) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$day >= 1 and $day <= 7
MC/DC0%0/2
$day >= 1 and $day <= 7
$day >= 1
$day <= 7
Truth table33%1/3
A and B
A= $day >= 1B= $day <= 7
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | or Carp::croak(q<Parameter 'day' is out of the range [1, 7]>); | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 672 | ▶ | if ($ordinal > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 336 | my $days = 7 * --$ordinal; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 336 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 336 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 336 | $tm = $tm->with_day_of_month(1); | |||||||||||||||||||||||||||||||||||||||||
| 137 | 336 | return $tm->plus_days($days + ($day - $tm->day_of_week) % 7); | |||||||||||||||||||||||||||||||||||||||||
| 138 | 336 | }; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 336 | my $days = 7 * ++$ordinal; | |||||||||||||||||||||||||||||||||||||||||
| 142 | 336 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 336 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 336 | $tm = $tm->at_last_day_of_month; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 336 | return $tm->plus_days($days - ($tm->day_of_week - $day) % 7); | |||||||||||||||||||||||||||||||||||||||||
| 146 | 336 | }; | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 500 | ▶ | sub WesternEasterSunday { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
WesternEasterSunday: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 500 | ▶ | @_ == 0 or Carp::croak(q<Usage: WesternEasterSunday()>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 500 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 500 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 500 | return $tm->with_rdn(Time::Moment::Internal::western_easter_sunday($tm->year)); | |||||||||||||||||||||||||||||||||||||||||
| 156 | 500 | }; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | sub OrthodoxEasterSunday { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
OrthodoxEasterSunday: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | @_ == 0 or Carp::croak(q<Usage: OrthodoxEasterSunday()>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | return $tm->with_rdn(Time::Moment::Internal::orthodox_easter_sunday($tm->year)); | |||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 7 | ▶ | sub NearestMinuteInterval { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
NearestMinuteInterval: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 7 | ▶ | @_ == 1 or Carp::croak(q<Usage: NearestMinuteInterval(interval)>); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 7 | my ($interval) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 7 | ▶ | ($interval >= 1 && $interval <= 1440) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$interval >= 1 and $interval <= 1440
MC/DC0%0/2
$interval >= 1 and $interval <= 1440
$interval >= 1
$interval <= 1440
Truth table33%1/3
A and B
A= $interval >= 1B= $interval <= 1440
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | or Carp::croak(q<Parameter 'interval' is out of the range [1, 1440]>); | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 7 | my $msec = $interval * 60 * 1000; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 7 | my $mid = int(($msec + 1) / 2); | |||||||||||||||||||||||||||||||||||||||||
| 177 | 7 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 7 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 7 | my $msod = $msec * int(($tm->millisecond_of_day + $mid) / $msec); | |||||||||||||||||||||||||||||||||||||||||
| 180 | 7 | return $tm->with_millisecond_of_day($msod); | |||||||||||||||||||||||||||||||||||||||||
| 181 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||