| Filename | /usr/lib/x86_64-linux-gnu/perl5/5.20/Date/Calc/XS.pm |
| Statements | Executed 17 statements in 2.69ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 1.74ms | 1.89ms | Date::Calc::XS::BEGIN@18 |
| 1 | 1 | 1 | 730µs | 730µs | Date::Calc::XS::BEGIN@14 |
| 1 | 1 | 1 | 86µs | 86µs | Date::Calc::XS::bootstrap (xsub) |
| 1 | 1 | 1 | 6µs | 16µs | Date::Calc::XS::BEGIN@15 |
| 1 | 1 | 1 | 6µs | 49µs | Date::Calc::XS::BEGIN@16 |
| 0 | 0 | 0 | 0s | 0s | Date::Calc::XS::Decode_Date_EU2 |
| 0 | 0 | 0 | 0s | 0s | Date::Calc::XS::Decode_Date_US2 |
| 0 | 0 | 0 | 0s | 0s | Date::Calc::XS::Parse_Date |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | ############################################################################### | ||||
| 3 | ## ## | ||||
| 4 | ## Copyright (c) 1995 - 2012 by Steffen Beyer. ## | ||||
| 5 | ## All rights reserved. ## | ||||
| 6 | ## ## | ||||
| 7 | ## This package is free software; you can redistribute it ## | ||||
| 8 | ## and/or modify it under the same terms as Perl itself. ## | ||||
| 9 | ## ## | ||||
| 10 | ############################################################################### | ||||
| 11 | |||||
| 12 | package Date::Calc::XS; | ||||
| 13 | |||||
| 14 | 2 | 744µs | 1 | 730µs | # spent 730µs within Date::Calc::XS::BEGIN@14 which was called:
# once (730µs+0s) by Date::Calc::BEGIN@18 at line 14 # spent 730µs making 1 call to Date::Calc::XS::BEGIN@14 |
| 15 | 2 | 23µs | 2 | 25µs | # spent 16µs (6+10) within Date::Calc::XS::BEGIN@15 which was called:
# once (6µs+10µs) by Date::Calc::BEGIN@18 at line 15 # spent 16µs making 1 call to Date::Calc::XS::BEGIN@15
# spent 10µs making 1 call to strict::import |
| 16 | 2 | 24µs | 2 | 93µs | # spent 49µs (6+44) within Date::Calc::XS::BEGIN@16 which was called:
# once (6µs+44µs) by Date::Calc::BEGIN@18 at line 16 # spent 49µs making 1 call to Date::Calc::XS::BEGIN@16
# spent 44µs making 1 call to vars::import |
| 17 | |||||
| 18 | 2 | 1.87ms | 2 | 1.95ms | # spent 1.89ms (1.74+151µs) within Date::Calc::XS::BEGIN@18 which was called:
# once (1.74ms+151µs) by Date::Calc::BEGIN@18 at line 18 # spent 1.89ms making 1 call to Date::Calc::XS::BEGIN@18
# spent 62µs making 1 call to Carp::Clan::import |
| 19 | |||||
| 20 | 1 | 600ns | require Exporter; | ||
| 21 | 1 | 300ns | require DynaLoader; | ||
| 22 | |||||
| 23 | 1 | 8µs | @ISA = qw(Exporter DynaLoader); | ||
| 24 | |||||
| 25 | 1 | 200ns | @EXPORT = qw(); | ||
| 26 | |||||
| 27 | 1 | 4µs | @EXPORT_OK = qw( | ||
| 28 | Days_in_Year | ||||
| 29 | Days_in_Month | ||||
| 30 | Weeks_in_Year | ||||
| 31 | leap_year | ||||
| 32 | check_date | ||||
| 33 | check_time | ||||
| 34 | check_business_date | ||||
| 35 | Day_of_Year | ||||
| 36 | Date_to_Days | ||||
| 37 | Day_of_Week | ||||
| 38 | Week_Number | ||||
| 39 | Week_of_Year | ||||
| 40 | Monday_of_Week | ||||
| 41 | Nth_Weekday_of_Month_Year | ||||
| 42 | Standard_to_Business | ||||
| 43 | Business_to_Standard | ||||
| 44 | Delta_Days | ||||
| 45 | Delta_DHMS | ||||
| 46 | Delta_YMD | ||||
| 47 | Delta_YMDHMS | ||||
| 48 | N_Delta_YMD | ||||
| 49 | N_Delta_YMDHMS | ||||
| 50 | Normalize_DHMS | ||||
| 51 | Add_Delta_Days | ||||
| 52 | Add_Delta_DHMS | ||||
| 53 | Add_Delta_YM | ||||
| 54 | Add_Delta_YMD | ||||
| 55 | Add_Delta_YMDHMS | ||||
| 56 | Add_N_Delta_YMD | ||||
| 57 | Add_N_Delta_YMDHMS | ||||
| 58 | System_Clock | ||||
| 59 | Today | ||||
| 60 | Now | ||||
| 61 | Today_and_Now | ||||
| 62 | This_Year | ||||
| 63 | Gmtime | ||||
| 64 | Localtime | ||||
| 65 | Mktime | ||||
| 66 | Timezone | ||||
| 67 | Date_to_Time | ||||
| 68 | Time_to_Date | ||||
| 69 | Easter_Sunday | ||||
| 70 | Decode_Month | ||||
| 71 | Decode_Day_of_Week | ||||
| 72 | Decode_Language | ||||
| 73 | Decode_Date_EU | ||||
| 74 | Decode_Date_US | ||||
| 75 | Fixed_Window | ||||
| 76 | Moving_Window | ||||
| 77 | Compress | ||||
| 78 | Uncompress | ||||
| 79 | check_compressed | ||||
| 80 | Compressed_to_Text | ||||
| 81 | Date_to_Text | ||||
| 82 | Date_to_Text_Long | ||||
| 83 | English_Ordinal | ||||
| 84 | Calendar | ||||
| 85 | Month_to_Text | ||||
| 86 | Day_of_Week_to_Text | ||||
| 87 | Day_of_Week_Abbreviation | ||||
| 88 | Language_to_Text | ||||
| 89 | Language | ||||
| 90 | Languages | ||||
| 91 | Decode_Date_EU2 | ||||
| 92 | Decode_Date_US2 | ||||
| 93 | Parse_Date | ||||
| 94 | ISO_LC | ||||
| 95 | ISO_UC | ||||
| 96 | ); | ||||
| 97 | |||||
| 98 | 1 | 6µs | %EXPORT_TAGS = (all => [@EXPORT_OK]); | ||
| 99 | |||||
| 100 | ################################################## | ||||
| 101 | ## ## | ||||
| 102 | ## "Version()" is available but not exported ## | ||||
| 103 | ## in order to avoid possible name clashes. ## | ||||
| 104 | ## Call "Date::Calc::XS::Version()" instead! ## | ||||
| 105 | ## ## | ||||
| 106 | ################################################## | ||||
| 107 | |||||
| 108 | 1 | 200ns | $VERSION = '6.3'; | ||
| 109 | |||||
| 110 | 1 | 8µs | 1 | 560µs | bootstrap Date::Calc::XS $VERSION; # spent 560µs making 1 call to DynaLoader::bootstrap |
| 111 | |||||
| 112 | sub Decode_Date_EU2 | ||||
| 113 | { | ||||
| 114 | croak "Usage: (\$year,\$month,\$day) = Decode_Date_EU2(\$date[,\$lang]);\n" unless ((@_ == 1) or (@_ == 2)); | ||||
| 115 | |||||
| 116 | my($buffer) = shift; | ||||
| 117 | my($lang) = shift || 0; | ||||
| 118 | my($year,$month,$day,$length); | ||||
| 119 | |||||
| 120 | $lang = Language() unless (($lang >= 1) and ($lang <= Languages())); | ||||
| 121 | if ($buffer =~ /^\D* (\d+) [^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* ([A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]+) [^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* (\d+) \D*$/x) | ||||
| 122 | { | ||||
| 123 | ($day,$month,$year) = ($1,$2,$3); | ||||
| 124 | $month = Decode_Month($month,$lang); | ||||
| 125 | unless ($month > 0) | ||||
| 126 | { | ||||
| 127 | return(); # can't decode month! | ||||
| 128 | } | ||||
| 129 | } | ||||
| 130 | elsif ($buffer =~ /^\D* 0*(\d+) \D*$/x) | ||||
| 131 | { | ||||
| 132 | $buffer = $1; | ||||
| 133 | $length = length($buffer); | ||||
| 134 | if ($length == 3) | ||||
| 135 | { | ||||
| 136 | $day = substr($buffer,0,1); | ||||
| 137 | $month = substr($buffer,1,1); | ||||
| 138 | $year = substr($buffer,2,1); | ||||
| 139 | } | ||||
| 140 | elsif ($length == 4) | ||||
| 141 | { | ||||
| 142 | $day = substr($buffer,0,1); | ||||
| 143 | $month = substr($buffer,1,1); | ||||
| 144 | $year = substr($buffer,2,2); | ||||
| 145 | } | ||||
| 146 | elsif ($length == 5) | ||||
| 147 | { | ||||
| 148 | $day = substr($buffer,0,1); | ||||
| 149 | $month = substr($buffer,1,2); | ||||
| 150 | $year = substr($buffer,3,2); | ||||
| 151 | } | ||||
| 152 | elsif ($length == 6) | ||||
| 153 | { | ||||
| 154 | $day = substr($buffer,0,2); | ||||
| 155 | $month = substr($buffer,2,2); | ||||
| 156 | $year = substr($buffer,4,2); | ||||
| 157 | } | ||||
| 158 | elsif ($length == 7) | ||||
| 159 | { | ||||
| 160 | $day = substr($buffer,0,1); | ||||
| 161 | $month = substr($buffer,1,2); | ||||
| 162 | $year = substr($buffer,3,4); | ||||
| 163 | } | ||||
| 164 | elsif ($length == 8) | ||||
| 165 | { | ||||
| 166 | $day = substr($buffer,0,2); | ||||
| 167 | $month = substr($buffer,2,2); | ||||
| 168 | $year = substr($buffer,4,4); | ||||
| 169 | } | ||||
| 170 | else { return(); } # wrong number of digits! | ||||
| 171 | } | ||||
| 172 | elsif ($buffer =~ /^\D* (\d+) \D+ (\d+) \D+ (\d+) \D*$/x) | ||||
| 173 | { | ||||
| 174 | ($day,$month,$year) = ($1,$2,$3); | ||||
| 175 | } | ||||
| 176 | else { return(); } # no match at all! | ||||
| 177 | $year = Moving_Window($year); | ||||
| 178 | if (check_date($year,$month,$day)) | ||||
| 179 | { | ||||
| 180 | return($year,$month,$day); | ||||
| 181 | } | ||||
| 182 | else { return(); } # not a valid date! | ||||
| 183 | } | ||||
| 184 | |||||
| 185 | sub Decode_Date_US2 | ||||
| 186 | { | ||||
| 187 | croak "Usage: (\$year,\$month,\$day) = Decode_Date_US2(\$date[,\$lang]);\n" unless ((@_ == 1) or (@_ == 2)); | ||||
| 188 | |||||
| 189 | my($buffer) = shift; | ||||
| 190 | my($lang) = shift || 0; | ||||
| 191 | my($year,$month,$day,$length); | ||||
| 192 | |||||
| 193 | $lang = Language() unless (($lang >= 1) and ($lang <= Languages())); | ||||
| 194 | if ($buffer =~ /^[^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* ([A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]+) [^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* 0*(\d+) \D*$/x) | ||||
| 195 | { | ||||
| 196 | ($month,$buffer) = ($1,$2); | ||||
| 197 | $month = Decode_Month($month,$lang); | ||||
| 198 | unless ($month > 0) | ||||
| 199 | { | ||||
| 200 | return(); # can't decode month! | ||||
| 201 | } | ||||
| 202 | $length = length($buffer); | ||||
| 203 | if ($length == 2) | ||||
| 204 | { | ||||
| 205 | $day = substr($buffer,0,1); | ||||
| 206 | $year = substr($buffer,1,1); | ||||
| 207 | } | ||||
| 208 | elsif ($length == 3) | ||||
| 209 | { | ||||
| 210 | $day = substr($buffer,0,1); | ||||
| 211 | $year = substr($buffer,1,2); | ||||
| 212 | } | ||||
| 213 | elsif ($length == 4) | ||||
| 214 | { | ||||
| 215 | $day = substr($buffer,0,2); | ||||
| 216 | $year = substr($buffer,2,2); | ||||
| 217 | } | ||||
| 218 | elsif ($length == 5) | ||||
| 219 | { | ||||
| 220 | $day = substr($buffer,0,1); | ||||
| 221 | $year = substr($buffer,1,4); | ||||
| 222 | } | ||||
| 223 | elsif ($length == 6) | ||||
| 224 | { | ||||
| 225 | $day = substr($buffer,0,2); | ||||
| 226 | $year = substr($buffer,2,4); | ||||
| 227 | } | ||||
| 228 | else { return(); } # wrong number of digits! | ||||
| 229 | } | ||||
| 230 | elsif ($buffer =~ /^[^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* ([A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]+) [^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* (\d+) \D+ (\d+) \D*$/x) | ||||
| 231 | { | ||||
| 232 | ($month,$day,$year) = ($1,$2,$3); | ||||
| 233 | $month = Decode_Month($month,$lang); | ||||
| 234 | unless ($month > 0) | ||||
| 235 | { | ||||
| 236 | return(); # can't decode month! | ||||
| 237 | } | ||||
| 238 | } | ||||
| 239 | elsif ($buffer =~ /^\D* 0*(\d+) \D*$/x) | ||||
| 240 | { | ||||
| 241 | $buffer = $1; | ||||
| 242 | $length = length($buffer); | ||||
| 243 | if ($length == 3) | ||||
| 244 | { | ||||
| 245 | $month = substr($buffer,0,1); | ||||
| 246 | $day = substr($buffer,1,1); | ||||
| 247 | $year = substr($buffer,2,1); | ||||
| 248 | } | ||||
| 249 | elsif ($length == 4) | ||||
| 250 | { | ||||
| 251 | $month = substr($buffer,0,1); | ||||
| 252 | $day = substr($buffer,1,1); | ||||
| 253 | $year = substr($buffer,2,2); | ||||
| 254 | } | ||||
| 255 | elsif ($length == 5) | ||||
| 256 | { | ||||
| 257 | $month = substr($buffer,0,1); | ||||
| 258 | $day = substr($buffer,1,2); | ||||
| 259 | $year = substr($buffer,3,2); | ||||
| 260 | } | ||||
| 261 | elsif ($length == 6) | ||||
| 262 | { | ||||
| 263 | $month = substr($buffer,0,2); | ||||
| 264 | $day = substr($buffer,2,2); | ||||
| 265 | $year = substr($buffer,4,2); | ||||
| 266 | } | ||||
| 267 | elsif ($length == 7) | ||||
| 268 | { | ||||
| 269 | $month = substr($buffer,0,1); | ||||
| 270 | $day = substr($buffer,1,2); | ||||
| 271 | $year = substr($buffer,3,4); | ||||
| 272 | } | ||||
| 273 | elsif ($length == 8) | ||||
| 274 | { | ||||
| 275 | $month = substr($buffer,0,2); | ||||
| 276 | $day = substr($buffer,2,2); | ||||
| 277 | $year = substr($buffer,4,4); | ||||
| 278 | } | ||||
| 279 | else { return(); } # wrong number of digits! | ||||
| 280 | } | ||||
| 281 | elsif ($buffer =~ /^\D* (\d+) \D+ (\d+) \D+ (\d+) \D*$/x) | ||||
| 282 | { | ||||
| 283 | ($month,$day,$year) = ($1,$2,$3); | ||||
| 284 | } | ||||
| 285 | else { return(); } # no match at all! | ||||
| 286 | $year = Moving_Window($year); | ||||
| 287 | if (check_date($year,$month,$day)) | ||||
| 288 | { | ||||
| 289 | return($year,$month,$day); | ||||
| 290 | } | ||||
| 291 | else { return(); } # not a valid date! | ||||
| 292 | } | ||||
| 293 | |||||
| 294 | sub Parse_Date | ||||
| 295 | { | ||||
| 296 | croak "Usage: (\$year,\$month,\$day) = Parse_Date(\$date[,\$lang]);\n" unless ((@_ == 1) or (@_ == 2)); | ||||
| 297 | |||||
| 298 | my($date) = shift; | ||||
| 299 | my($lang) = shift || 0; | ||||
| 300 | my($year,$month,$day); | ||||
| 301 | |||||
| 302 | $lang = Language() unless (($lang >= 1) and ($lang <= Languages())); | ||||
| 303 | unless ($date =~ /\b([\x41-\x5A\x61-\x7A\xC0-\xD6\xD8-\xF6\xF8-\xFF]{3})\s+([0123]??\d)\b/) | ||||
| 304 | { | ||||
| 305 | return(); | ||||
| 306 | } | ||||
| 307 | $month = $1; | ||||
| 308 | $day = $2; | ||||
| 309 | unless ($date =~ /\b(19\d\d|20\d\d)\b/) | ||||
| 310 | { | ||||
| 311 | return(); | ||||
| 312 | } | ||||
| 313 | $year = $1; | ||||
| 314 | $month = Decode_Month($month,$lang); | ||||
| 315 | unless ($month > 0) | ||||
| 316 | { | ||||
| 317 | return(); | ||||
| 318 | } | ||||
| 319 | unless (check_date($year,$month,$day)) | ||||
| 320 | { | ||||
| 321 | return(); | ||||
| 322 | } | ||||
| 323 | return($year,$month,$day); | ||||
| 324 | } | ||||
| 325 | |||||
| 326 | 1 | 7µs | 1; | ||
| 327 | |||||
| 328 | __END__ | ||||
# spent 86µs within Date::Calc::XS::bootstrap which was called:
# once (86µs+0s) by DynaLoader::bootstrap at line 210 of DynaLoader.pm |