| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SOAP::WSDL::XSD::Typelib::Builtin::date; |
|
2
|
36
|
|
|
36
|
|
1091
|
use strict; |
|
|
36
|
|
|
|
|
127
|
|
|
|
36
|
|
|
|
|
1340
|
|
|
3
|
36
|
|
|
36
|
|
230
|
use warnings; |
|
|
36
|
|
|
|
|
684
|
|
|
|
36
|
|
|
|
|
1187
|
|
|
4
|
36
|
|
|
36
|
|
36891
|
use Date::Parse; |
|
|
36
|
|
|
|
|
382568
|
|
|
|
36
|
|
|
|
|
6823
|
|
|
5
|
36
|
|
|
36
|
|
48980
|
use Date::Format; |
|
|
36
|
|
|
|
|
164387
|
|
|
|
36
|
|
|
|
|
3359
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
36
|
|
|
36
|
|
1611
|
use Class::Std::Fast::Storable constructor => 'none', cache => 1; |
|
|
36
|
|
|
|
|
30649
|
|
|
|
36
|
|
|
|
|
478
|
|
|
8
|
36
|
|
|
36
|
|
7289
|
use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); |
|
|
36
|
|
|
|
|
80
|
|
|
|
36
|
|
|
|
|
14902
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub set_value { |
|
11
|
|
|
|
|
|
|
# use set_value from base class if we have a XML-DateTime format |
|
12
|
|
|
|
|
|
|
#2037-12-31+01:00 |
|
13
|
30
|
100
|
|
30
|
0
|
2204
|
if ( |
|
14
|
|
|
|
|
|
|
$_[1] =~ m{ ^\d{4} \- \d{2} \- \d{2} |
|
15
|
|
|
|
|
|
|
(:? [\+\-] \d{2} \: \d{2} )$ |
|
16
|
|
|
|
|
|
|
}xms |
|
17
|
|
|
|
|
|
|
) { |
|
18
|
2
|
|
|
|
|
10
|
$_[0]->SUPER::set_value($_[1]) |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
# converting a date is hard work: It needs a timezone, because |
|
21
|
|
|
|
|
|
|
# 2007-12-30+12:00 and 2007-12-31-12:00 mean the same day - just in |
|
22
|
|
|
|
|
|
|
# different locations. |
|
23
|
|
|
|
|
|
|
# strftime actually prints out the correct date, but always prints the |
|
24
|
|
|
|
|
|
|
# local timezone with %z. |
|
25
|
|
|
|
|
|
|
# So, if our timezone is not 0, we strftime it without timezone and |
|
26
|
|
|
|
|
|
|
# append it by hand by the following formula: |
|
27
|
|
|
|
|
|
|
# The timezone hours are the int (timesone seconds / 3600) |
|
28
|
|
|
|
|
|
|
# The timezone minutes (if someone ever specifies something like that) |
|
29
|
|
|
|
|
|
|
# are int( (seconds % 3600) / 60 ) |
|
30
|
|
|
|
|
|
|
# say, int( (seconds modulo 3600) / 60 ) |
|
31
|
|
|
|
|
|
|
# |
|
32
|
|
|
|
|
|
|
# If we have no timezone (meaning the timezone is |
|
33
|
|
|
|
|
|
|
else { |
|
34
|
|
|
|
|
|
|
# strptime sets empty values to undef - and strftime doesn't like that... |
|
35
|
28
|
|
|
|
|
693
|
my @time_from = strptime($_[1]); |
|
36
|
28
|
|
|
|
|
2212
|
my $time_zone_seconds = $time_from[6]; |
|
37
|
28
|
100
|
|
|
|
59
|
@time_from = map { (! defined $_) ? 0 : $_ } @time_from; |
|
|
196
|
|
|
|
|
456
|
|
|
38
|
|
|
|
|
|
|
# use Data::Dumper; |
|
39
|
|
|
|
|
|
|
# warn Dumper \@time_from, sprintf('%+03d%02d', $time_from[6] / 3600, $time_from[6] % 60 ); |
|
40
|
28
|
|
|
|
|
45
|
my $time_str; |
|
41
|
28
|
100
|
|
|
|
47
|
if (defined $time_zone_seconds) { |
|
42
|
25
|
|
|
|
|
151
|
$time_str = sprintf('%04d-%02d-%02d%+03d:%02d', $time_from[5]+1900, $time_from[4]+1, $time_from[3], int($time_from[6] / 3600), int($time_from[6] % 3600) / 60); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
else { |
|
45
|
3
|
|
|
|
|
10
|
$time_str = strftime( '%Y-%m-%d%z', @time_from ); |
|
46
|
3
|
|
|
|
|
557
|
substr $time_str, -2, 0, ':'; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# ? strftime( '%Y-%m-%d', @time_from ) |
|
50
|
|
|
|
|
|
|
# . sprintf('%+03d%02d', int($time_from[6] / 3600), int ( ($time_from[6] % 3600) / 60 ) ) |
|
51
|
|
|
|
|
|
|
# : do { |
|
52
|
|
|
|
|
|
|
# strftime( '%Y-%m-%d%z', @time_from ); |
|
53
|
|
|
|
|
|
|
# }; |
|
54
|
|
|
|
|
|
|
# substr $time_str, -2, 0, ':'; |
|
55
|
28
|
|
|
|
|
115
|
$_[0]->SUPER::set_value($time_str); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
|
60
|
|
|
|
|
|
|
|