Branch Coverage

blib/lib/Time/ParseDate.pm
Criterion Covered Total %
branch 344 494 69.6


line true false branch
82 147 146 defined $options{'NOW'} ? :
84 6 287 defined $options{'UK'} ? :
88 9 284 if ($t =~ s[^ ([ \d]\d) / (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) / (\d\d\d\d) : (\d\d) : (\d\d) : (\d\d) (?: [ ] ([-+] \d\d\d\d) (?: \("?(?:(?:[A-Z]{1,4}[TCW56])|IDLE)\))? )? $break ][]xi) { }
1 283 elsif ($t =~ s[^(\d\d)/(\d\d)/(\d\d)\.(\d\d)\:(\d\d)($break)][]) { }
104 5 4 $7 ? :
105 0 9 if $Time::ParseDate::debug
112 0 1 if $Time::ParseDate::debug
115 321 1 unless (defined $m or defined $rd or defined $y or $passes == 0 and $options{'TIMEFIRST'})
119 201 120 if (&parse_date_only(\$t, \$y, \$m, \$d, $uk))
120 0 201 if $Time::ParseDate::debug
124 328 52 unless (defined $H or defined $rs)
125 161 167 if (&parse_time_only(\$t, \$H, \$M, \$S, \$tz, %options))
128 0 161 if $Time::ParseDate::debug
132 0 77 if $passes == 0 and $options{'TIMEFIRST'}
133 252 228 unless (defined $y)
134 37 215 if (&parse_year_only(\$t, \$y, $now, %options))
135 0 37 if $Time::ParseDate::debug
139 203 120 if (not defined $tz || defined $tzo || defined $rs and defined $m || defined $H)
142 63 140 if (&parse_tz_only(\$t, \$tz, \$tzo))
143 0 63 if $Time::ParseDate::debug
147 167 52 unless (defined $H or defined $rs)
148 38 129 if (&parse_time_offset(\$t, \$rs, %options))
150 0 38 if $Time::ParseDate::debug
154 82 0 unless (defined $m or defined $rd or defined $y)
155 57 25 if (&parse_date_offset(\$t, $now, \$y, \$m, \$d, \$rd, \$rs, %options))
159 0 57 if $Time::ParseDate::debug
163 205 80 if (defined $M or defined $rd)
164 2 203 if ($t =~ s/^\s*(?:at|\@|\+)($break)//x)
166 0 2 if $Time::ParseDate::debug
173 0 559 if $Time::ParseDate::debug
177 3 280 if ($passes == 0)
178 0 3 if $Time::ParseDate::debug
179 0 3 if wantarray
185 0 290 if $Time::ParseDate::debug
189 15 275 if ($t ne '')
191 0 15 if $Time::ParseDate::debug
192 2 13 if ($options{'WHOLE'})
193 0 2 if wantarray
201 22 44 unless (defined $y or defined $m or defined $rd)
202 0 22 if $Time::ParseDate::debug
203 22 0 if (defined $rs or defined $H) { }
205 0 22 if ($options{'DATE_REQUIRED'})
206 0 0 if wantarray
210 17 5 if (defined $rs)
211 0 17 if $Time::ParseDate::debug
213 0 17 if wantarray
218 0 0 if $Time::ParseDate::debug
219 0 0 if wantarray
225 0 1 if ($options{'TIME_REQUIRED'} and not defined $rs and not defined $H and not defined $rd)
228 0 0 if wantarray
236 49 222 if (defined $rd) { }
237 42 7 if (defined $rs or not defined $H || defined $M || defined $S)
238 0 42 if $Time::ParseDate::debug
240 18 24 defined $rs ? :
250 28 14 if ($isdst_now == $isdst_then or $options{'GMT'})
252 0 28 if wantarray
256 0 14 if $Time::ParseDate::debug
259 0 21 if $Time::ParseDate::debug
261 3 18 $options{'GMT'} ? :
263 0 21 if $Time::ParseDate::debug
266 19 203 unless (defined $y)
267 4 15 if ($options{'PREFER_PAST'}) { }
3 12 elsif ($options{'PREFER_FUTURE'}) { }
271 0 4 if $Time::ParseDate::debug
272 2 2 if $mon011 + 1 < $m or $mon011 + 1 == $m and $day < $d
275 0 3 if $Time::ParseDate::debug
278 1 2 if $mon011 >= $m or $mon011 + 1 == $m and $day > $d
281 0 12 if $Time::ParseDate::debug
287 65 157 if $y < 100
290 6 216 if ($options{'VALIDATE'})
293 2 4 if ($y < 1000 or $m < 1 or $d < 1 or $y > 9999 or $m > 12 or $d > $dim)
296 0 2 if wantarray
302 0 220 if $Time::ParseDate::debug
307 72 169 unless (defined $H)
308 28 44 if (defined $rd or defined $rs)
310 0 28 if $Time::ParseDate::debug
316 0 0 defined $rs ? :
0 241 if $Time::ParseDate::debug
324 101 140 unless $S
325 68 173 unless $M
326 66 175 unless $H
328 2 2 if ($options{'VALIDATE'} and $S < 0 || $M < 0 || $H < 0 || $S > 59 || $M > 59 || $H > 23)
331 0 2 if wantarray
335 20 219 if defined $rs
346 0 239 if $Time::ParseDate::debug
349 0 239 if $Time::ParseDate::debug
358 43 196 if ($tz) { }
27 169 elsif (defined $tzo) { }
360 43 0 if (defined $tzadj) { }
361 0 43 if $Time::ParseDate::debug
365 0 0 if $Time::ParseDate::debug
370 0 27 if $Time::ParseDate::debug
373 166 3 unless ($options{'GMT'})
374 38 128 if ($options{'ZONE'}) { }
377 0 38 unless (defined $tzadj)
378 0 0 if wantarray
382 0 38 if $Time::ParseDate::debug
386 0 128 if $Time::ParseDate::debug
397 0 239 if $Time::ParseDate::debug
399 1 238 if wantarray
408 28 0 if (defined $offset and $offset =~ s/^([-+])(\d\d):?(\d\d)$//)
409 18 10 $1 eq '+' ? :
423 4 199 if ($$tr =~ s/^ ([-+]\d\d:?\d\d) \s+ \( "? (?: (?: [A-Z]{1,4}[TCW56] ) | IDLE ) \) $break //x) { }
6 193 elsif ($$tr =~ s/^GMT\s*([-+]\d{1,2})($break)//x) { }
13 180 elsif ($$tr =~ s/^(?:GMT\s*)?([-+]\d\d:?\d\d)($break)//x) { }
40 140 elsif ($$tr =~ s/^"?((?:[A-Z]{1,4}[TCW56])|IDLE)$break//x) { }
439 0 4 if $Time::ParseDate::debug
443 6 0 if ($o < 24 and not $o =~ /^0/)
445 0 6 if $Time::ParseDate::debug
450 0 6 if $Time::ParseDate::debug
455 0 13 if $Time::ParseDate::debug
459 1 39 if $$tz eq 'MET' and $$tr =~ s/^DST$break//x
461 0 40 if $Time::ParseDate::debug
473 39 282 if ($$tr =~ s[^(\d\d\d\d)([-./])(\d\d?)\2(\d\d?)(T|$break)][]) { }
15 267 elsif ($$tr =~ s[^(\d\d?)([-./])(\d\d?)\2(\d\d\d\d?)($break)][]) { }
1 266 elsif ($$tr =~ s[^(\d\d\d\d)/(\d\d?)$break][]x) { }
26 240 elsif ($$tr =~ s[^(?xi) (?: (?:Mon|Monday|Tue|Tuesday|Wed|Wednesday| Thu|Thursday|Fri|Friday| Sat|Saturday|Sun|Sunday),? \s+ )? (\d\d?) (\s+ | - | \. | /) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\.? (?: \2 (\d\d (?:\d\d)? ) )? $break ][]) { }
50 190 elsif ($$tr =~ s[^(?xi) (?: (?:Mon|Monday|Tue|Tuesday|Wed|Wednesday| Thu|Thursday|Fri|Friday| Sat|Saturday|Sun|Sunday),? \s+ )? (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\.? ((\s)+ | - | \. | /) (\d\d?) ,? (?: (?: \2|\3+) (\d\d (?: \d\d)?) )? $break ][]) { }
9 181 elsif ($$tr =~ s/^(?xi) (January|Jan\.?|February|Feb\.?|March|Mar\.?|April|Apr\.?|May| June|Jun\.?|July|Jul\.?|August|Aug\.?|September|Sep\.?| October|Oct\.?|November|Nov\.?|December|Dec\.?) \s+ (\d+) (?:st|nd|rd|th)? \,? (?: \s+ (?: (\d\d\d\d) |(?:\' (\d\d)) ) )? $break //) { }
46 135 elsif ($$tr =~ s[^(\d\d?)([-/.])(\d\d?)\2(\d\d?)($break)][]x) { }
5 130 elsif ($$tr =~ s[^(\d\d?)/(\d\d?)($break)][]x) { }
8 122 elsif ($$tr =~ s/^(\d\d)(\d\d)(\d\d)($break)//x) { }
1 121 elsif ($$tr =~ s[^(?xi) (\d{1,2}) (\s+ | - | \. | /) (January|Jan\.?|February|Feb\.?|March|Mar\.?|April|Apr\.?|May| June|Jun\.?|July|Jul\.?|August|Aug\.?|September|Sep\.?| October|Oct\.?|November|Nov\.?|December|Dec\.?) (?: \2 ( \d\d (?:\d\d)? ) ) $break ][]) { }
1 120 elsif ($$tr =~ s/^(?xi) (\d+) (?:st|nd|rd|th)? \s+ (January|Jan\.?|February|Feb\.?|March|Mar\.?|April|Apr\.?|May| June|Jun\.?|July|Jul\.?|August|Aug\.?|September|Sep\.?| October|Oct\.?|November|Nov\.?|December|Dec\.?) (?: \,? \s+ (\d\d\d\d) )? $break //) { }
477 0 39 if $Time::ParseDate::debug
483 8 7 if ($uk or $1 > 12) { }
488 0 15 if $Time::ParseDate::debug
494 0 1 if $Time::ParseDate::debug
515 0 26 if $Time::ParseDate::debug
516 0 26 if $Time::ParseDate::debug and not defined $$yr
539 0 50 if $Time::ParseDate::debug
540 0 50 if $Time::ParseDate::debug and not defined $$yr
564 0 9 if $Time::ParseDate::debug
565 0 9 if $Time::ParseDate::debug and not defined $$yr
566 0 9 if $Time::ParseDate::debug
569 17 29 if ($1 > 31 or not $uk and $1 > 12 and $4 < 32) { }
4 25 elsif ($1 > 12 or $uk) { }
579 0 46 if $Time::ParseDate::debug
582 1 4 if ($1 > 31 or not $uk and $1 > 12) { }
1 3 elsif ($2 > 31 or $uk and $2 > 12) { }
0 3 elsif ($1 > 12 or $uk) { }
595 0 5 if $Time::ParseDate::debug
598 7 1 if ($1 > 31 or not $uk and $1 > 12) { }
0 1 elsif ($1 > 12 or $uk) { }
608 0 8 if $Time::ParseDate::debug
627 0 1 if $Time::ParseDate::debug
645 0 1 if $Time::ParseDate::debug
646 0 1 if $Time::ParseDate::debug and not defined $$yr
647 0 1 if $Time::ParseDate::debug
659 157 171 if ($$tr =~ s/^(?x) (?: (?: ([012]\d) (?# $1) (?: ([0-5]\d) (?# $2) (?: ([0-5]\d) (?# $3) )? ) \s* ([apAP][mM])? (?# $4) ) | (?: (\d{1,2}) (?# $5) (?: \: (\d\d) (?# $6) (?: \: (\d\d) (?# $7) ( (?# don't barf on database sub-second timings) [:.,] \d+ )? (?# $8) )? ) \s* ([apAP][mM])? (?# $9) ) | (?: (\d{1,2}) (?# $10) ([apAP][mM]) (?# ${11}) ) ) (?: \s+ "? ( (?# ${12}) (?: [A-Z]{1,4}[TCW56] ) | IDLE ) )? $break //) { }
2 169 elsif ($$tr =~ s/^noon$break//xi) { }
2 167 elsif ($$tr =~ s/^midnight$break//xi) { }
709 7 0 if (defined $8 and exists $options{'SUBSECOND'} and $options{'SUBSECOND'})
714 0 157 if $Time::ParseDate::debug
717 20 11 if $ampm and (uc $ampm eq 'PM' and $$hr != 12)
718 5 152 if $$hr == 12 and uc $ampm eq 'AM'
719 0 157 if $Time::ParseDate::debug
724 0 2 if $Time::ParseDate::debug
729 0 2 if $Time::ParseDate::debug
741 0 167 if $options{'NO_RELATIVE'}
743 38 129 if ($$tr =~ s[^(?xi) (?: (-) (?# 1) | [+] )? \s* (?: (\d+(?:\.\d+)?) (?# 2) | (?:(\d+)\s+(\d+)/(\d+)) (?# 3 4/5) ) \s* (sec|second|min|minute|hour)s? (?# 6) ( \s+ ago (?# 7) )? $break ][])
764 38 0 unless defined $$rsr
765 0 38 if defined $5 and $5 == 0
766 37 1 defined $2 ? :
769 10 28 if $1
772 5 33 if $7 or $$tr =~ /\b(day|mon|month|year)s?\s*ago\b/
774 0 38 if $Time::ParseDate::debug
798 0 65 if $yr > 100
807 3 62 if ($options{'PREFER_PAST'}) { }
3 59 elsif ($options{'PREFER_FUTURE'}) { }
0 59 elsif ($options{'UNAMBIGUOUS'}) { }
808 2 1 if ($yr > $within)
813 1 2 if ($yr < $within - 20)
823 1 58 if ($within > 80 and $within - $yr > 60)
827 35 24 if ($within < 30 and $yr - $within > 59)
831 0 65 if $Time::ParseDate::debug
840 0 33 unless $units
842 0 33 if $Time::ParseDate::debug
844 17 16 if ($units eq 'day') { }
3 13 elsif ($units eq 'week') { }
0 13 elsif ($umult{$units}) { }
7 6 elsif ($units eq 'mon' or $units eq 'month') { }
6 0 elsif ($units eq 'year') { }
852 5 2 unless $$rsr
855 6 0 unless $$rsr
859 0 33 if $Time::ParseDate::debug
871 0 13 if $Time::ParseDate::debug
875 0 13 if $Time::ParseDate::debug
876 6 7 if ($m11 > 11 or $m11 < 0)
877 2 4 if $m11 < 0 and $m11 % 12 != 0
884 0 13 if $Time::ParseDate::debug
895 4 9 if ($d > 30 or $d > 28 and $m11 == 1)
898 0 4 if $Time::ParseDate::debug
899 2 2 if $d > $dim
907 3 192 if ($options{'GMT'}) { }
920 37 215 if ($$tr =~ s/^(\d\d\d\d)$break//) { }
0 215 elsif ($$tr =~ s/\'(\d\d)$break//) { }
922 0 37 if $Time::ParseDate::debug
926 0 0 if $Time::ParseDate::debug
936 0 82 if $options{'NO_RELATIVE'}
950 10 72 if ($$tr =~ s/^(?xi) \s* (\d+) \s* (day|week|month|year)s? ( \s+ ago )? $break //) { }
16 56 elsif ($$tr =~ s/^(?xi) (?: (?: now \s+ )? (\+ | \-) \s* )? (\d+) \s* (day|week|month|year)s? $break //) { }
1 55 elsif ($$tr =~ s/^(?xi) (Mon|Tue|Wed|Thu|Fri|Sat|Sun|Monday|Tuesday |Wednesday|Thursday|Friday|Saturday|Sunday) \s+ after \s+ next $break //) { }
2 53 elsif ($$tr =~ s/^(?xi) (Mon|Tue|Wed|Thu|Fri|Sat|Sun|Monday|Tuesday |Wednesday|Thursday|Friday|Saturday|Sunday) \s+ before \s+ last $break //) { }
4 49 elsif ($$tr =~ s/^(?xi) next\s+ (Mon|Tue|Wed|Thu|Fri|Sat|Sun|Monday|Tuesday |Wednesday|Thursday|Friday|Saturday|Sunday) $break //) { }
3 46 elsif ($$tr =~ s/^(?xi) last\s+ (Mon|Tue|Wed|Thu|Fri|Sat|Sun|Monday|Tuesday |Wednesday|Thursday|Friday|Saturday|Sunday) $break//) { }
3 43 elsif ($options{'PREFER_PAST'} and $$tr =~ s/^(?xi) (Mon|Tue|Wed|Thu|Fri|Sat|Sun|Monday|Tuesday |Wednesday|Thursday|Friday|Saturday|Sunday) $break//) { }
3 40 elsif ($options{'PREFER_FUTURE'} and $$tr =~ s/^(?xi) (Mon|Tue|Wed|Thu|Fri|Sat|Sun|Monday|Tuesday |Wednesday|Thursday|Friday|Saturday|Sunday) $break //) { }
1 39 elsif ($$tr =~ s/^today$break//xi) { }
1 38 elsif ($$tr =~ s/^tomorrow$break//xi) { }
1 37 elsif ($$tr =~ s/^yesterday$break//xi) { }
4 33 elsif ($$tr =~ s/^last\s+(week|month|year)$break//xi) { }
3 30 elsif ($$tr =~ s/^next\s+(week|month|year)$break//xi) { }
5 25 elsif ($$tr =~ s/^now $break//x) { }
963 3 7 if $3 or $$tr =~ /\b(sec|second|min|minute|hour)s?\s*ago\b/
967 0 10 if $Time::ParseDate::debug
988 0 16 if $Time::ParseDate::debug
1000 1 0 $wdays{lc $1} > $wday ? :
1001 0 1 if $Time::ParseDate::debug
1013 1 1 $wdays{lc $1} < $wday ? :
1014 0 2 if $Time::ParseDate::debug
1024 1 3 $wdays{lc $1} > $wday ? :
1025 0 4 if $Time::ParseDate::debug
1033 0 3 if $Time::ParseDate::debug
1034 1 2 $wdays{lc $1} < $wday ? :
1035 0 3 if $Time::ParseDate::debug
1042 0 3 if $Time::ParseDate::debug
1043 1 2 $wdays{lc $1} < $wday ? :
1044 0 3 if $Time::ParseDate::debug
1053 1 2 $wdays{lc $1} > $wday ? :
1054 0 3 if $Time::ParseDate::debug
1059 0 1 if $Time::ParseDate::debug
1063 0 1 if $Time::ParseDate::debug
1067 0 1 if $Time::ParseDate::debug
1071 0 4 if $Time::ParseDate::debug
1075 0 3 if $Time::ParseDate::debug
1088 0 0 defined $tz ? :
1089 0 0 defined $tzo ? :
1091 0 0 defined $H ? :
1092 0 0 defined $M ? :
1093 0 0 defined $S ? :
1095 0 0 defined $m ? :
1096 0 0 defined $d ? :
1097 0 0 defined $y ? :
1098 0 0 defined $rs ? :
1099 0 0 defined $rd ? :
1100 0 0 $rel ? :