line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SOAP::WSDL::XSD::Typelib::Builtin::time; |
2
|
36
|
|
|
36
|
|
702
|
use strict; |
|
36
|
|
|
|
|
41
|
|
|
36
|
|
|
|
|
936
|
|
3
|
36
|
|
|
36
|
|
115
|
use warnings; |
|
36
|
|
|
|
|
35
|
|
|
36
|
|
|
|
|
660
|
|
4
|
36
|
|
|
36
|
|
119
|
use Date::Parse; |
|
36
|
|
|
|
|
31
|
|
|
36
|
|
|
|
|
3629
|
|
5
|
36
|
|
|
36
|
|
144
|
use Date::Format; |
|
36
|
|
|
|
|
36
|
|
|
36
|
|
|
|
|
1921
|
|
6
|
36
|
|
|
36
|
|
514
|
use Class::Std::Fast::Storable constructor => 'none', cache => 1; |
|
36
|
|
|
|
|
13747
|
|
|
36
|
|
|
|
|
205
|
|
7
|
36
|
|
|
36
|
|
3240
|
use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); |
|
36
|
|
|
|
|
47
|
|
|
36
|
|
|
|
|
7566
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 3.003; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub set_value { |
12
|
|
|
|
|
|
|
# use set_value from base class if we have a XML-Time format |
13
|
|
|
|
|
|
|
# 00:00:00.0000000+01:00 |
14
|
2
|
100
|
|
2
|
0
|
310
|
if ( |
15
|
|
|
|
|
|
|
$_[1] =~ m{ ^ \d{2} \: \d{2} \: \d{2} (:? \. \d{1,7} )? |
16
|
|
|
|
|
|
|
[\+\-] \d{2} \: \d{2} $ |
17
|
|
|
|
|
|
|
}xms |
18
|
|
|
|
|
|
|
) { |
19
|
1
|
|
|
|
|
3
|
$_[0]->SUPER::set_value($_[1]) |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
# use a combination of strptime and strftime for converting the date |
22
|
|
|
|
|
|
|
# Unfortunately, strftime outputs the time zone as [+-]0000, whereas XML |
23
|
|
|
|
|
|
|
# whants it as [+-]00:00 |
24
|
|
|
|
|
|
|
# We leave out the optional nanoseconds part, as it would always be empty. |
25
|
|
|
|
|
|
|
else { |
26
|
|
|
|
|
|
|
# strptime sets empty values to undef - and strftime doesn't like that... |
27
|
|
|
|
|
|
|
# we even need to set it to 1 to prevent a "Day '0' out of range 1..31" warning.. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# we need to set the current date for correct TZ conversion - |
30
|
|
|
|
|
|
|
# could be daylight savings time |
31
|
1
|
|
|
|
|
20
|
my @now = localtime; |
32
|
1
|
|
|
|
|
22
|
my @time_from = map { my $alternative = shift @now; |
|
7
|
|
|
|
|
303
|
|
33
|
7
|
100
|
|
|
|
12
|
! defined $_ |
34
|
|
|
|
|
|
|
? $alternative |
35
|
|
|
|
|
|
|
: $_ } strptime($_[1]); |
36
|
1
|
|
|
|
|
1
|
undef $time_from[-1]; |
37
|
1
|
|
|
|
|
4
|
my $time_str = strftime( '%H:%M:%S%z', @time_from ); |
38
|
1
|
|
|
|
|
150
|
substr $time_str, -2, 0, ':'; |
39
|
1
|
|
|
|
|
6
|
$_[0]->SUPER::set_value($time_str); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |