| 1 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | Date::Fmtstr2time - Functions to format date/time strings into a Perl Time based on a "Picture" format string. | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | Jim Turner | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | (c) 2015-2019, Jim Turner under the same license that Perl 5 itself is. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | use Date::Fmtstr2time; | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | my $timevalue = str2time('12-25-2015 07:15 AM', 'mm-dd-yyyy hh:mi PM'); | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | die $timevalue if ($timevalue =~ /\D/); | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | print "Perl time (seconds since epoc): $timevalue.\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | Date::Fmtstr2time provides a single function B<str2time> that accepts a date or date / time | ||||||||||||||||||||||||||||||||||||||||||
| 24 | as a string (I<data-string>), and a I<format-string> consisting of special substrings which represent | ||||||||||||||||||||||||||||||||||||||||||
| 25 | the format of various parts of a date and time value. It returns a standard Perl (Unix) "time" | ||||||||||||||||||||||||||||||||||||||||||
| 26 | value (a large integer equivalent to the number of seconds since 1980) or an error string. | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | =item $integer = B<str2time>(I<data-string>, I<format-string>); | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | Returns a standard Perl (Unix) "time" value (a large integer) on success, or an error message | ||||||||||||||||||||||||||||||||||||||||||
| 35 | string on failure. One can easily check for failure by checking the result for any non-integer | ||||||||||||||||||||||||||||||||||||||||||
| 36 | characters (=~ /\D/). The I<format-string> tells | ||||||||||||||||||||||||||||||||||||||||||
| 37 | the software what format to expect the date / time value in the I<data-string> to be in. | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | For example: | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | $s = &str2time('01-09-2016 01:20 AM (Sat) (January)', 'mm-dd-yyyy hh:mi PM (Day) (Month)'); | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | would set $s to 1452324000, (the Unix time equivalent). | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | =item B<Special Formatting Substrings> | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | There are numerous choices of special format substrings which can be used in an infinite | ||||||||||||||||||||||||||||||||||||||||||
| 48 | number of combinations to produce the desired results. They are listed below: | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | B<a>, B<A>, B<am>, or B<AM> - Assume hour is AM (if 1-11), and convert 12 to midnight | ||||||||||||||||||||||||||||||||||||||||||
| 53 | (0 in 24-hour time). (all specifiers are identical and case insensitive). See also: | ||||||||||||||||||||||||||||||||||||||||||
| 54 | B<p>, B<P>, B<pm>, or B<PM> below. | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | B<day>, B<Day>, or B<DAY> - Three letter abbreviation of the day of the week | ||||||||||||||||||||||||||||||||||||||||||
| 57 | (case insensitive), ie. "sun". Reason for the three versions is to match up with | ||||||||||||||||||||||||||||||||||||||||||
| 58 | L<Date::Time2fmtstr>, which has three separate versions for I<outputting> the desired case, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | but here (I<inputting>), case doesn't matter. This applies also to Month, etc. and | ||||||||||||||||||||||||||||||||||||||||||
| 60 | similiarly to functions that pad or don't pad with leading zeros! | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | B<dayofweek>, B<Dayofweek>, or B<DAYOFWEEK> - Day of the week (case insensitive). | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | B<ddd> - Number of days since beginning of year. NOTE: This is calculated by adding | ||||||||||||||||||||||||||||||||||||||||||
| 65 | the number of SECONDS (86400 per day) to midnight, 1/1/current-year, so if spanning a | ||||||||||||||||||||||||||||||||||||||||||
| 66 | daylight-savings time boundary may result in +1 hour difference, which the underlying | ||||||||||||||||||||||||||||||||||||||||||
| 67 | Perl localtime/timelocal functions will take into account! For example, if the current | ||||||||||||||||||||||||||||||||||||||||||
| 68 | time was "1570286966" (2019/10/05 09:49:26), the following code: | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | print &time2str(&str2time(&time2str(1570286966, 'ddd, hh:mi:ss'), 'ddd, hh:mi:ss'), 'yyyy/mm/dd hh:mi:ss') . "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | would print "2019/10/05 10:49:26" due to the fact that 1 hour (3600 seconds) was | ||||||||||||||||||||||||||||||||||||||||||
| 73 | automatically skipped over when DST was imposed between 1 January and 5 October. This | ||||||||||||||||||||||||||||||||||||||||||
| 74 | "feature" only applies when calculating the date/time based on days since beginning | ||||||||||||||||||||||||||||||||||||||||||
| 75 | of the year ("ddd"). | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | B<dd>, B<d1> - Day of month (1 or 2 digits, left padded with a zero if needed), ie. | ||||||||||||||||||||||||||||||||||||||||||
| 78 | "3" or "03" for March. | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | B<d0>, B<d> - Numeric day of the week zero-based (Sunday=0, Monday=1, ... Saturday=6). | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | B<hh>, B<h1> - Hour in common format, ie. 1-12 (1 or 2 digits, as needed). | ||||||||||||||||||||||||||||||||||||||||||
| 83 | (see B<AM> and B<PM> specifiers). | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | B<hhmi>, B<h1mi> - Hours and minutes in 12-hour time (hours and minutes no colon). | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | B<hhmiss> - Hours, minutes and seconds in 12-hour time (no colons). Must be six | ||||||||||||||||||||||||||||||||||||||||||
| 88 | digits. | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | B<hh24>, B<HHmi> - Hours and minutes in 24-hour (military) time (no colon). | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | B<HH>, B<H1> - Hour in 24-hour format, ie. 00-23 (1 or 2 digits, as needed). | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | B<HHmiss> - Hours, minutes and seconds in 24-hour (military) time (no colons). | ||||||||||||||||||||||||||||||||||||||||||
| 95 | Must be six digits. | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | B<mi> - Minute, ie. 0-59 (1 or 2 digits, as needed). | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | B<mm>, B<m1> - Number of month (1 or 2 digits, as needed), ie. "1" or "01" for January. | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | B<mmdd> - Numeric date in 4 digits, ie. "0107" for January, 7, (current year). | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | B<mmddyy> - Numeric date in 6 digits, ie. "010715" for January 7, 2015. | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | B<mmddyyyy> - Numeric date in 8 digits, ie. "01072015" for January 7, 2015. | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | B<mmmm>, B<mmm0> - Minutes since start of day (0-3599). | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | B<mmyy> - Numeric date in 4 digits, ie. "0115" for January, 2015. | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | B<mmyyyy> - Numeric date in 6 digits, ie. "012015" for January, 2015. | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | B<mon>, B<Mon>, or B<MON> - Three letter abbreviation of the month (case insensitive), | ||||||||||||||||||||||||||||||||||||||||||
| 114 | ie. "jan" for January. | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | B<month>, B<Month>, or B<MONTH> - The Full name of the month (case insensitive), | ||||||||||||||||||||||||||||||||||||||||||
| 117 | ie. "january". | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | B<p>, B<P>, B<pm>, or B<PM> - Assume hour is noon if 12, otherwise, convert (add 12 to) | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 1-11 to convert to PM (13-23 in 24 hour time). (all specifiers are identical). | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | B<q> - Number of the quarter of the year - (1-4). | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | B<rm> - Roman numeral for the month (i-xii) in lower case. | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | B<RM> - Roman numeral for the month (I-XII) in upper case. | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | B<ss> - Seconds since start of last minute (1 or 2 digits as needed), ie. 0-59. | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | B<sssss>, B<ssss0> - Seconds since start of day (0-86399) 1-5 digits as needed | ||||||||||||||||||||||||||||||||||||||||||
| 131 | (leading zeros ignored). | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | B<w> - Number of week (one-based) of the month (1-5). | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | B<ww> - Number of week (one-based) of the year (1-52) (1 or 2 digits as needed). | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | B<yy>, B<rr> - Year in last 2 digits. | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | B<yymm> - Numeric date in 4 digits, ie. "1501" for January, 2015. | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | B<yymmdd> - Numeric date in 6 digits, ie. "150107" for January 7, 2015. | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | B<yyyy>, B<rrrr> - Year in 4 digits. | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | B<yyyymm> - Numeric date in 6 digits, ie. "201501" for January, 2015. | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | B<yyyymmdd> - Numeric date in 8 digits, ie. "20150107" for January 7, 2015. | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | B<yyyymmddhhmi> - Numeric date/time in 12 digits, ie. "201501071345" for January 7, 2015 1:45pm. | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | B<yyyymmddhhmiss> - Numeric date/time in 14 digits, ie. "20150107134512" for January 7, 2015 1:45:12pm. | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | =head1 DEPENDENCIES | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | Perl 5 | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | L<Time::Local> | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | =head1 RECCOMENDS | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | L<Date::Time2fmtstr> | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | Please report any bugs or feature requests to C<bug-Date-Fmtstr2time at rt.cpan.org>, or through | ||||||||||||||||||||||||||||||||||||||||||
| 170 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Date-Fmtstr2time>. I will be notified, and then you'll | ||||||||||||||||||||||||||||||||||||||||||
| 171 | automatically be notified of progress on your bug as I make changes. | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | perldoc Date::Fmtstr2time | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | =item * RT: CPAN's request tracker (report bugs here) | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Date-Fmtstr2time> | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | L<http://annocpan.org/dist/Date-Fmtstr2time> | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | L<http://cpanratings.perl.org/d/Date-Fmtstr2time> | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | L<http://search.cpan.org/dist/Date-Fmtstr2time/> | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | L<Date::Time2fmtstr> | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | =head1 KEYWORDS | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | Date::Fmtstr2time, Date::Time2fmtstr, formatting, picture_clause, strings | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | Copyright (C) 2015-2019 Jim Turner | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||
| 214 | under the terms of the the Artistic License (2.0). You may obtain a | ||||||||||||||||||||||||||||||||||||||||||
| 215 | copy of the full license at: | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | Any use, modification, and distribution of the Standard or Modified | ||||||||||||||||||||||||||||||||||||||||||
| 220 | Versions is governed by this Artistic License. By using, modifying or | ||||||||||||||||||||||||||||||||||||||||||
| 221 | distributing the Package, you accept this license. Do not use, modify, | ||||||||||||||||||||||||||||||||||||||||||
| 222 | or distribute the Package, if you do not accept this license. | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | If your Modified Version has been derived from a Modified Version made | ||||||||||||||||||||||||||||||||||||||||||
| 225 | by someone other than you, you are nevertheless required to ensure that | ||||||||||||||||||||||||||||||||||||||||||
| 226 | your Modified Version complies with the requirements of this license. | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | This license does not grant you the right to use any trademark, service | ||||||||||||||||||||||||||||||||||||||||||
| 229 | mark, tradename, or logo of the Copyright Holder. | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | This license includes the non-exclusive, worldwide, free-of-charge | ||||||||||||||||||||||||||||||||||||||||||
| 232 | patent license to make, have made, use, offer to sell, sell, import and | ||||||||||||||||||||||||||||||||||||||||||
| 233 | otherwise transfer the Package with respect to any patent claims | ||||||||||||||||||||||||||||||||||||||||||
| 234 | licensable by the Copyright Holder that are necessarily infringed by the | ||||||||||||||||||||||||||||||||||||||||||
| 235 | Package. If you institute patent litigation (including a cross-claim or | ||||||||||||||||||||||||||||||||||||||||||
| 236 | counterclaim) against any party alleging that the Package constitutes | ||||||||||||||||||||||||||||||||||||||||||
| 237 | direct or contributory patent infringement, then this Artistic License | ||||||||||||||||||||||||||||||||||||||||||
| 238 | to you shall terminate on the date that such litigation is filed. | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||||||||||||||||||||||||||||||||||||||||||
| 241 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||||||||||||||||||||||||||||||||||||||||||
| 242 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||||||||||||||||||||||||||||||||||||||||||
| 243 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||||||||||||||||||||||||||||||||||||||||||
| 244 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||||||||||||||||||||||||||||||||||||||||||
| 245 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||||||||||||||||||||||||||||||||||||||||||
| 246 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||||||||||||||||||||||||||||||||||||||||||
| 247 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | package Date::Fmtstr2time; | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | #use warnings; | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 1 | ▶ | use vars qw(@ISA @EXPORT $VERSION); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 1 | $VERSION = '1.11'; | |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 1 | ▶ | use Time::Local; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 1 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 1 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | @EXPORT = qw(str2time); | |||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | my @inputs = (); | |||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | my @today = ();; | |||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | my $rtnTime = ''; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | my @tl = (); | |||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | my $begofyear; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | my %mthhash = ( | |||||||||||||||||||||||||||||||||||||||||
| 271 | 'january' => '0', | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 'february' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 'march' => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 'april' => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 'may' => 4, | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 'june' => 5, | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 'july' => 6, | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 'august' => 7, | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 'september' => 8, | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 'october' => 9, | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 'november' => 10, | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 'december' => 11 | ||||||||||||||||||||||||||||||||||||||||||
| 283 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | sub str2time | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
str2time: not called CC=17 SCAR=55.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my ($s) = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my ($f) = $_[1]; | |||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | my @fmts = split(/\b/o, $f); | |||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | @inputs = split(/\b/o, $s); | |||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | @today = localtime(time); | |||||||||||||||||||||||||||||||||||||||||
| 293 | #print STDERR "-to_date: inputs=".join('|',@inputs)."=\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 294 | #print STDERR "-to_date: formats=".join('|',@fmts)."=\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | my $err = ''; | |||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | $rtnTime = ''; #USED IF "ddd" (Days since beg. of year) AND AN OTHERWISE INCOMPLETE mm/dd/yy DATE GIVEN. | |||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | @tl = (); | |||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | $begofyear = timelocal(0,0,0,1,0,$today[5]); | |||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | my $fn; | |||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | for (my $i=0;$i<=$#fmts;$i++) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | { | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | next unless ($fmts[$i] =~ /\w/o); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | foreach my $f (qw(month Month MONTH dayofweek Dayofweek DAYOFWEEK day Day DAY ddd | |||||||||||||||||||||||||||||||||||||||||
| 305 | dd d1 d0 mmddyyyy yyyymmddhhmiss yyyymmddhhmi yyyymmdd yyyymm yymmdd mmyyyy | ||||||||||||||||||||||||||||||||||||||||||
| 306 | mmddyy yyyy yymm mmyy yy mmdd hh24 HHmiss hhmiss HHmi h1mi hhmi hh HH h1 H1 mi | ||||||||||||||||||||||||||||||||||||||||||
| 307 | mmm0 mmmm mm mon Mon MON m1 ssss0 sssss ss am pm AM PM a p A P rm RM rr d ww w q)) | ||||||||||||||||||||||||||||||||||||||||||
| 308 | { | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | if ($fmts[$i] =~ /^$f/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | { | ||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $fn = '_tod_'.$f; | |||||||||||||||||||||||||||||||||||||||||
| 312 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $err .= &$fn($i); | |||||||||||||||||||||||||||||||||||||||||
| 314 | #print "-to_date: called($fn($i)), input=$inputs[$i]= res=$err= tl=".join('|',@tl)."= RT=$rtnTime=\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | return $err if ($err =~ /\w/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | #print "***** rtnTime =$rtnTime= tl=".join('|',@tl)." ($#tl)\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | if ($rtnTime >= $begofyear) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | return $rtnTime if ($#tl < 5); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | for (my $i=3;$i<=5;$i++) { #FILL IN ANY MISSING MTH,DAY,YEAR WITH TODAY (DEFAULT IF NO ERRORS): | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | $tl[$i] = $today[$i] unless (defined $tl[$i]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | $tl[3] = '1' unless ($tl[3]); #MAKE SURE DAY IS ONE-BASED! | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | #NOW DOUBLE-CHECK WHAT WE'RE FEEDING TO timelocal(): | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | $err .= "e:Invalid second ($tl[0]) - must be 0-59! " if ($tl[0] > 59); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | $err .= "e:Invalid minute ($tl[1]) - must be 0-59! " if ($tl[1] > 59); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | $err .= "e:Invalid hour ($tl[2]) - must be 0-23! " if ($tl[2] > 23); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | $err .= "e:Invalid day ($tl[3]) - must be 1-31! " if ($tl[3] > 31); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | $err .= "e:Invalid month ($tl[4]) - must be 0-11! " if ($tl[4] > 11); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | #WE'RE NOT CURRENTLY CHECKING YEAR, SINCE THERE ARE TOO MANY VALID VALUES. | ||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | return $err if ($err =~ /\w/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my $rt = timelocal(@tl); | |||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | #print "***** tl=".join('|',@tl)." ($#tl) = rt=$rt=\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | return $rt; | |||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | sub _tod_month | ||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_month: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $input =~ tr/A-Z/a-z/; | |||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $tl[4] = $mthhash{$input}; | |||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | return "e:Invalid Month ($input)! " unless (length($tl[4])); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | sub _tod_Month | ||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_Month: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | return &_tod_month(@_); | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | sub _tod_MONTH | ||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_MONTH: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | return &_tod_month(@_); | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | sub _tod_mon | ||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_mon: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | my %mthhash = ( | |||||||||||||||||||||||||||||||||||||||||
| 373 | 'jan' => '0', | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 'feb' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 375 | 'mar' => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 376 | 'apr' => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 377 | 'may' => 4, | ||||||||||||||||||||||||||||||||||||||||||
| 378 | 'jun' => 5, | ||||||||||||||||||||||||||||||||||||||||||
| 379 | 'jul' => 6, | ||||||||||||||||||||||||||||||||||||||||||
| 380 | 'aug' => 7, | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 'sep' => 8, | ||||||||||||||||||||||||||||||||||||||||||
| 382 | 'oct' => 9, | ||||||||||||||||||||||||||||||||||||||||||
| 383 | 'nov' => 10, | ||||||||||||||||||||||||||||||||||||||||||
| 384 | 'dec' => 11 | ||||||||||||||||||||||||||||||||||||||||||
| 385 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $input =~ tr/A-Z/a-z/; | |||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | $tl[4] = $mthhash{substr($input,0,3)}; | |||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | return "e:Invalid Mth ($input)! " unless (length($tl[4])); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | sub _tod_Mon | ||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_Mon: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | return &_tod_mon(@_); | |||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | sub _tod_MON | ||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_MON: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | return &_tod_mon(@_); | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | sub _tod_rm | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_rm: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | my %mthhash = ( | |||||||||||||||||||||||||||||||||||||||||
| 409 | 'i' => '0', | ||||||||||||||||||||||||||||||||||||||||||
| 410 | 'ii' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 411 | 'iii' => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 412 | 'iv' => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 413 | 'v' => 4, | ||||||||||||||||||||||||||||||||||||||||||
| 414 | 'vi' => 5, | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 'vii' => 6, | ||||||||||||||||||||||||||||||||||||||||||
| 416 | 'viii' => 7, | ||||||||||||||||||||||||||||||||||||||||||
| 417 | 'ix' => 8, | ||||||||||||||||||||||||||||||||||||||||||
| 418 | 'x' => 9, | ||||||||||||||||||||||||||||||||||||||||||
| 419 | 'xi' => 10, | ||||||||||||||||||||||||||||||||||||||||||
| 420 | 'xii' => 11 | ||||||||||||||||||||||||||||||||||||||||||
| 421 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | $input =~ tr/A-Z/a-z/; | |||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $tl[4] = $mthhash{$input}; | |||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | return "e:Invalid Roman Month. ($input)! " unless (length($tl[4])); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | sub _tod_RM | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_RM: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | return &_tod_rm(@_); | |||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | sub _tod_mm | ||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_mm: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | $input =~ s/^0//; | |||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | return "e:Invalid month ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input > 0 and $input <= 12
MC/DC0%0/2
$input > 0 and $input <= 12
$input > 0
$input <= 12
Truth table0%0/3
A and B
A= $input > 0B= $input <= 12
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | unless ($input > 0 && $input <= 12); | ||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | $tl[4] = $input - 1; | |||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | sub _tod_m1 | ||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_m1: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | return &_tod_mm(@_); | |||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | sub _tod_yyyymmdd | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_yyyymmdd: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | &_tod_yyyy($indx, substr($input,0,4)); | |||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | &_tod_mm($indx, substr($input,4,2)); | |||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | return &_tod_dd($indx, substr($input,6,2)); | |||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | sub _tod_yyyymmddhhmi | ||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_yyyymmddhhmi: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | return "e:Invalid yyyymmddhhmi ($input) - must be 12-digit number! " unless ($input =~ /^\d{12}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | &_tod_yyyy($indx, substr($input,0,4)); | |||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | &_tod_mm($indx, substr($input,4,2)); | |||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | &_tod_dd($indx, substr($input,6,2)); | |||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | return &_tod_hh24($indx, substr($input,8,4)); | |||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | sub _tod_yyyymmddhhmiss | ||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_yyyymmddhhmiss: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | return "e:Invalid yyyymmddhhmiss ($input) - must be 14-digit number! " unless ($input =~ /^\d{14}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | &_tod_yyyy($indx, substr($input,0,4)); | |||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | &_tod_mm($indx, substr($input,4,2)); | |||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | &_tod_dd($indx, substr($input,6,2)); | |||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | &_tod_hh24($indx, substr($input,8,4)); | |||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | return &_tod_ss($indx, substr($input,12,2)); | |||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | sub _tod_yyyymm | ||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_yyyymm: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | return "e:Invalid yyyymm ($input) - must be 6-digit number! " unless ($input =~ /^\d{6}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | &_tod_yyyy($indx, substr($input,0,4)); | |||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | return &_tod_mm($indx, substr($input,4,2)); | |||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||
| 500 | sub _tod_yymmdd | ||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_yymmdd: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | return "e:Invalid yymmdd ($input) - must be 6-digit number! " unless ($input =~ /^\d{6}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | &_tod_rr($indx, substr($input,0,2)); | |||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | &_tod_mm($indx, substr($input,2,2)); | |||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | return &_tod_dd($indx, substr($input,4,2)); | |||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | sub _tod_yymm | ||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_yymm: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | return "e:Invalid yymm ($input) - must be 4-digit number! " unless ($input =~ /^\d{4}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | &_tod_rr($indx, substr($input,0,2)); | |||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | return &_tod_mm($indx, substr($input,2,2)); | |||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | sub _tod_mmyyyy | ||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_mmyyyy: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | return "e:Invalid mmyyyy ($input) - must be 6-digit number! " unless ($input =~ /^\d{6}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | &_tod_mm($indx, substr($input,0,2)); | |||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | return &_tod_yyyy($indx, substr($input,2,4)); | |||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||
| 534 | sub _tod_mmyy | ||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_mmyy: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | ▶ | return "e:Invalid mmyy ($input) - must be 4-digit number! " unless ($input =~ /^\d{4}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | &_tod_mm($indx, substr($input,0,2)); | |||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | return &_tod_rr($indx, substr($input,2,2)); | |||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | sub _tod_mmddyyyy | ||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_mmddyyyy: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | return "e:Invalid _tod_mmddyyyy ($input) - must be 8-digit number! " unless ($input =~ /^\d{8}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | &_tod_mm($indx, substr($input,0,2)); | |||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | &_tod_dd($indx, substr($input,2,2)); | |||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | return &_tod_yyyy($indx, substr($input,4,4)); | |||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | sub _tod_mmddyy | ||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_mmddyy: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | return "e:Invalid mmddyy ($input) - must be 6-digit number! " unless ($input =~ /^\d{6}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | &_tod_mm($indx, substr($input,0,2)); | |||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | &_tod_dd($indx, substr($input,2,2)); | |||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | return &_tod_rr($indx, substr($input,4,2)); | |||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | sub _tod_mmdd | ||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_mmdd: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | return "e:Invalid mmyy ($input) - must be 4-digit number! " unless ($input =~ /^\d{4}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | &_tod_mm($indx, substr($input,0,2)); | |||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | return &_tod_dd($indx, substr($input,2,2)); | |||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | sub _tod_yyyy | ||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_yyyy: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | ▶ | return "e:Invalid year ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 586 | unless ($input =~ /^\d\d\d\d$/); | ||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | $tl[5] = $input - 1900; | |||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | sub _tod_yy | ||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_yy: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | return &_tod_rr(@_); | |||||||||||||||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||
| 597 | sub _tod_rr | ||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_rr: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | ▶ | return "e:Invalid year ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 603 | unless ($input =~ /^\d\d$/); | ||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | if (($today[5] % 100) > 50) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 606 | { | ||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | $input += 100 if ($input < 50); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||
| 609 | else | ||||||||||||||||||||||||||||||||||||||||||
| 610 | { | ||||||||||||||||||||||||||||||||||||||||||
| 611 | #$input -= 100 if ($input > 50); | ||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | $input += 100 if ($input < 50); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | $tl[5] = $input; | |||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | sub _tod_rrrr | ||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_rrrr: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | ▶ | return &_tod_rr($indx) if ($input =~ /^\d\d?$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | ▶ | return "e:Invalid year ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 625 | unless ($input =~ /^\d\d\d\d?$/); | ||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | if (($today[5] % 100) > 50) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 628 | { | ||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | ▶ | $input += 100 if (($input % 100) < 50); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||
| 631 | else | ||||||||||||||||||||||||||||||||||||||||||
| 632 | { | ||||||||||||||||||||||||||||||||||||||||||
| 633 | #$input -= 100 if (($input % 100) > 50); | ||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | ▶ | $input += 100 if ($input < 50); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | $tl[5] = $input - 1900; | |||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||
| 640 | sub _tod_ddd | ||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_ddd: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | $input =~ s/^0+//; | |||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | ▶ | return "e:Invalid year-day ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input > 0 and $input <= 366
MC/DC0%0/2
$input > 0 and $input <= 366
$input > 0
$input <= 366
Truth table0%0/3
A and B
A= $input > 0B= $input <= 366
| |||||||||||||||||||||||||||||||||||||||||||
| 647 | unless ($input > 0 and $input <= 366); | ||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | ▶ | $rtnTime += $begofyear + (($input*86400) - 86400) unless ($rtnTime > 86400); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||
| 653 | sub _tod_dd | ||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_dd: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | ▶ | return "e:Invalid day ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input > 0 and $input <= 31
MC/DC0%0/2
$input > 0 and $input <= 31
$input > 0
$input <= 31
Truth table0%0/3
A and B
A= $input > 0B= $input <= 31
| |||||||||||||||||||||||||||||||||||||||||||
| 659 | unless ($input > 0 and $input <= 31); | ||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | $tl[3] = $input; | |||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||
| 665 | sub _tod_d1 | ||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_d1: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | return &_tod_dd(@_); | |||||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | sub _tod_hh | ||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_hh: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | ▶ | return "e:Invalid hour ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input > 0 and $input <= 12
MC/DC0%0/2
$input > 0 and $input <= 12
$input > 0
$input <= 12
Truth table0%0/3
A and B
A= $input > 0B= $input <= 12
| |||||||||||||||||||||||||||||||||||||||||||
| 676 | unless ($input > 0 and $input <= 12); | ||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | ▶ | unless ($tl[2] =~ /\d/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | $tl[2] = $input; | |||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | ▶ | $rtnTime += ($input * 3600) if ($rtnTime); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | sub _tod_h1 | ||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_h1: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | return &_tod_hh(@_); | |||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||
| 690 | sub _tod_HH | ||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_HH: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | ▶ | return "e:Invalid hour ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input >= 0 and $input < 24
MC/DC0%0/2
$input >= 0 and $input < 24
$input >= 0
$input < 24
Truth table0%0/3
A and B
A= $input >= 0B= $input < 24
| |||||||||||||||||||||||||||||||||||||||||||
| 696 | unless ($input >= 0 and $input < 24); | ||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | unless ($tl[2] =~ /\d/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | $tl[2] = $input; | |||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | ▶ | $rtnTime += ($input * 3600) if ($rtnTime); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | sub _tod_H1 | ||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_H1: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | return &_tod_HH(@_); | |||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||
| 710 | sub _tod_hh24 | ||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_hh24: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | return "e:Invalid 24-hr time ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$input >= 0 and ($input < 2400 and $input % 100 < 60)
$input < 2400 and $input % 100 < 60
MC/DC0%0/3
$input >= 0 and ($input < 2400 and $input % 100 < 60)
$input >= 0
$input < 2400
$input % 100 < 60
Truth table0%0/4
A and B and C
A= $input >= 0B= $input < 2400C= $input % 100 < 60
| |||||||||||||||||||||||||||||||||||||||||||
| 716 | unless ($input >= 0 and $input < 2400 | ||||||||||||||||||||||||||||||||||||||||||
| 717 | && ($input % 100) < 60); | ||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | unless ($tl[1] =~ /\d/ || $tl[2] =~ /\d/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tl[1] =~ /\d/ or $tl[2] =~ /\d/
MC/DC0%0/2
$tl[1] =~ /\d/ or $tl[2] =~ /\d/
$tl[1] =~ /\d/
$tl[2] =~ /\d/
Truth table0%0/3
A or B
A= $tl[1] =~ /\d/B= $tl[2] =~ /\d/
| |||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | $tl[1] = ($input % 100); | |||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | $input = int($input / 100); | |||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | $tl[2] = $input; | |||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | $rtnTime += ($tl[2] * 3600) + ($tl[1] * 60) if ($rtnTime); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||
| 728 | sub _tod_HHmi | ||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_HHmi: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | return &_tod_hh24(@_) | |||||||||||||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||
| 733 | sub _tod_hhmi | ||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_hhmi: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | ▶ | return "e:Invalid time ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input < 100 or $input > 1259
MC/DC0%0/2
$input < 100 or $input > 1259
$input < 100
$input > 1259
Truth table0%0/3
A or B
A= $input < 100B= $input > 1259
| |||||||||||||||||||||||||||||||||||||||||||
| 739 | if ($input < 100 || $input > 1259); | ||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | ▶ | unless ($tl[1] =~ /\d/ || $tl[2] =~ /\d/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tl[1] =~ /\d/ or $tl[2] =~ /\d/
MC/DC0%0/2
$tl[1] =~ /\d/ or $tl[2] =~ /\d/
$tl[1] =~ /\d/
$tl[2] =~ /\d/
Truth table0%0/3
A or B
A= $tl[1] =~ /\d/B= $tl[2] =~ /\d/
| |||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | $tl[1] = ($input % 100); | |||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | $input = int($input / 100); | |||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | $tl[2] = $input; | |||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | ▶ | $rtnTime += ($tl[2] * 3600) + ($tl[1] * 60) if ($rtnTime); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||
| 749 | sub _tod_hhmiss | ||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_hhmiss: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | return "e:Invalid hhmiss ($input) - must be 6-digit number! " unless ($input =~ /^\d{6}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | &_tod_hh($indx, substr($input,0,2)); | |||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | &_tod_mi($indx, substr($input,2,2)); | |||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | return &_tod_ss($indx, substr($input,4,2)); | |||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||
| 761 | sub _tod_HHmiss | ||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_HHmiss: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | ▶ | return "e:Invalid HHmiss ($input) - must be 6-digit number! " unless ($input =~ /^\d{6}$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | &_tod_hh24($indx, substr($input,0,4)); | |||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | return &_tod_ss($indx, substr($input,4,2)); | |||||||||||||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||
| 772 | sub _tod_a | ||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_a: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | ▶ | if ($tl[2] < 12) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 778 | { | ||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | ▶ | if ($input =~ /p/io) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | $tl[2] += 12; | |||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | ▶ | $rtnTime += 43200 if ($rtnTime); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||
| 784 | else | ||||||||||||||||||||||||||||||||||||||||||
| 785 | { | ||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | ▶ | if ($input =~ /a/io) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | $tl[2] -= 12; | |||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | ▶ | $rtnTime -= 43200 if ($rtnTime); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 789 | } | ||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||
| 794 | sub _tod_p | ||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_p: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | return &_tod_a; | |||||||||||||||||||||||||||||||||||||||||
| 797 | } | ||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||
| 799 | sub _tod_A | ||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_A: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | return &_tod_a; | |||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||
| 804 | sub _tod_P | ||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_P: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | return &_tod_a; | |||||||||||||||||||||||||||||||||||||||||
| 807 | } | ||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||
| 809 | sub _tod_am | ||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_am: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | return &_tod_a; | |||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||
| 814 | sub _tod_pm | ||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_pm: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | return &_tod_a; | |||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||
| 819 | sub _tod_AM | ||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_AM: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | return &_tod_a; | |||||||||||||||||||||||||||||||||||||||||
| 822 | } | ||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||
| 824 | sub _tod_PM | ||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_PM: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | return &_tod_a; | |||||||||||||||||||||||||||||||||||||||||
| 827 | } | ||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||
| 829 | sub _tod_mi | ||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_mi: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | ▶ | return "e:Invalid minutes ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input >= 0 and $input <= 59
MC/DC0%0/2
$input >= 0 and $input <= 59
$input >= 0
$input <= 59
Truth table0%0/3
A and B
A= $input >= 0B= $input <= 59
| |||||||||||||||||||||||||||||||||||||||||||
| 835 | unless ($input >= 0 and $input <= 59); | ||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | ▶ | unless ($tl[1] =~ /\d/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | $tl[1] = $input; | |||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | ▶ | $rtnTime += ($input * 60) if ($rtnTime); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | sub _tod_sssss #SECONDS SINCE MIDNIGHT OF CURRENT DAY: | ||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_sssss: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | ▶ | return "e:Invalid seconds ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input >= 0 and $input < 86400
MC/DC0%0/2
$input >= 0 and $input < 86400
$input >= 0
$input < 86400
Truth table0%0/3
A and B
A= $input >= 0B= $input < 86400
| |||||||||||||||||||||||||||||||||||||||||||
| 850 | unless ($input >= 0 and $input < 86400); | ||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | ▶ | unless ($tl[0] =~ /\d/ || $tl[1] =~ /\d/ || $tl[2] =~ /\d/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tl[0] =~ /\d/ or $tl[1] =~ /\d/ or $tl[2] =~ /\d/
$tl[0] =~ /\d/ or $tl[1] =~ /\d/
MC/DC0%0/3
$tl[0] =~ /\d/ or $tl[1] =~ /\d/ or $tl[2] =~ /\d/
$tl[0] =~ /\d/
$tl[1] =~ /\d/
$tl[2] =~ /\d/
Truth table0%0/4
A or B or C
A= $tl[0] =~ /\d/B= $tl[1] =~ /\d/C= $tl[2] =~ /\d/
| |||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | $tl[2] = int($input / 3600); | |||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | $tl[0] = $input % 60; | |||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | $tl[1] = int($input / 60) % 60; | |||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | ▶ | $rtnTime += $input if ($rtnTime); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 857 | } | ||||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 859 | } | ||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||
| 861 | sub _tod_ssss0 #SECONDS SINCE MIDNIGHT OF CURRENT DAY: | ||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_ssss0: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | return &_tod_sssss(@_); | |||||||||||||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||
| 866 | sub _tod_mmmm #MINUTES SINCE MIDNIGHT OF CURRENT DAY: | ||||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_mmmm: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | ▶ | return "e:Invalid minutes ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input >= 0 and $input < 1440
MC/DC0%0/2
$input >= 0 and $input < 1440
$input >= 0
$input < 1440
Truth table0%0/3
A and B
A= $input >= 0B= $input < 1440
| |||||||||||||||||||||||||||||||||||||||||||
| 872 | unless ($input >= 0 and $input < 1440); | ||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | ▶ | unless ($tl[1] =~ /\d/ || $tl[2] =~ /\d/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tl[1] =~ /\d/ or $tl[2] =~ /\d/
MC/DC0%0/2
$tl[1] =~ /\d/ or $tl[2] =~ /\d/
$tl[1] =~ /\d/
$tl[2] =~ /\d/
Truth table0%0/3
A or B
A= $tl[1] =~ /\d/B= $tl[2] =~ /\d/
| |||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | $tl[2] = int($input / 60); | |||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | $tl[1] = int($input % 60); | |||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | ▶ | $rtnTime += ($input / 60) if ($rtnTime); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 880 | } | ||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||
| 882 | sub _tod_mmm0 #MINUTES SINCE MIDNIGHT OF CURRENT DAY: | ||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_mmm0: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | return &_tod_mmmm(@_); | |||||||||||||||||||||||||||||||||||||||||
| 885 | } | ||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||
| 887 | sub _tod_ss | ||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_ss: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | ▶ | return "e:Invalid seconds ($input)! " | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input >= 0 and $input <= 59
MC/DC0%0/2
$input >= 0 and $input <= 59
$input >= 0
$input <= 59
Truth table0%0/3
A and B
A= $input >= 0B= $input <= 59
| |||||||||||||||||||||||||||||||||||||||||||
| 893 | unless ($input >= 0 and $input <= 59); | ||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | ▶ | unless ($tl[0] =~ /\d/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | $tl[0] = $input; | |||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ▶ | $rtnTime += $input if ($rtnTime); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 898 | } | ||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 900 | } | ||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||
| 902 | sub _tod_d | ||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_d: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||
| 907 | sub _tod_d0 | ||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_d0: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 910 | } | ||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||
| 912 | sub _tod_day | ||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_day: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | my %dayhash = ( | |||||||||||||||||||||||||||||||||||||||||
| 918 | 'sun' => '0', | ||||||||||||||||||||||||||||||||||||||||||
| 919 | 'mon' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 920 | 'tue' => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 921 | 'wed' => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 922 | 'thu' => 4, | ||||||||||||||||||||||||||||||||||||||||||
| 923 | 'fri' => 5, | ||||||||||||||||||||||||||||||||||||||||||
| 924 | 'sat' => 6 | ||||||||||||||||||||||||||||||||||||||||||
| 925 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | $input =~ tr/A-Z/a-z/; | |||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | return "e:Invalid Day ($input)! " unless (defined $dayhash{$input}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||
| 932 | sub _tod_Day | ||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_Day: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 934 | 0 | return &_tod_day(@_); | |||||||||||||||||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||
| 937 | sub _tod_DAY | ||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_DAY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | return &_tod_day(@_); | |||||||||||||||||||||||||||||||||||||||||
| 940 | } | ||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||
| 942 | sub _tod_dayofweek | ||||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_dayofweek: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | my %dayhash = ( | |||||||||||||||||||||||||||||||||||||||||
| 948 | 'sunday' => '0', | ||||||||||||||||||||||||||||||||||||||||||
| 949 | 'monday' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 950 | 'tuesday' => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 951 | 'wednesday' => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 952 | 'thursday' => 4, | ||||||||||||||||||||||||||||||||||||||||||
| 953 | 'friday' => 5, | ||||||||||||||||||||||||||||||||||||||||||
| 954 | 'saturday' => 6 | ||||||||||||||||||||||||||||||||||||||||||
| 955 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | $input =~ tr/A-Z/a-z/; | |||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | ▶ | return "e:Invalid Day ($input)! " unless (defined $dayhash{$input}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||
| 962 | sub _tod_Dayofweek | ||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_Dayofweek: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | return &_tod_dayofweek(@_); | |||||||||||||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||
| 967 | sub _tod_DAYOFWEEK | ||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_DAYOFWEEK: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | return &_tod_dayofweek(@_); | |||||||||||||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||
| 972 | sub _tod_ww | ||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_ww: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 975 | } | ||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||
| 977 | sub _tod_w | ||||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_w: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 980 | } | ||||||||||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||||||||||
| 982 | sub _tod_q | ||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tod_q: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | my $indx = shift; | |||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | ▶ | my $input = shift || $inputs[$indx]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $inputs[$indx]
MC/DC0%0/2
shift() || $inputs[$indx]
shift()
$inputs[$indx]
Truth table0%0/3
A || B
A= shift()B= $inputs[$indx]
| |||||||||||||||||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | ▶ | return "e:Invalid Quarter ($input) - must be 1-4! " if ($input < 1 || $input > 4); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$input < 1 or $input > 4
MC/DC0%0/2
$input < 1 or $input > 4
$input < 1
$input > 4
Truth table0%0/3
A or B
A= $input < 1B= $input > 4
| |||||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | ▶ | unless ($#tl >= 5) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | ▶ | $tl[3] ||= 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$tl[3] ||= 1
MC/DC0%0/1
$tl[3] ||= 1
$tl[3]
Truth table0%0/2
A
A= $tl[3]
| |||||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | $tl[4] = ($input-1)*3; | |||||||||||||||||||||||||||||||||||||||||
| 991 | } | ||||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 993 | } | ||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||
| 995 | 1 | 1 | |||||||||||||||||||||||||||||||||||||||||