line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Linux::Perl::TimeSpec; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
37
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
124
|
|
4
|
5
|
|
|
5
|
|
21
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
155
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use constant { |
7
|
5
|
|
|
|
|
2276
|
_TEMPLATE => 'L!L!', |
8
|
|
|
|
|
|
|
_NANO => 1_000_000_000, |
9
|
5
|
|
|
5
|
|
22
|
}; |
|
5
|
|
|
|
|
9
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub from_float { |
12
|
24
|
|
|
24
|
0
|
50
|
my ($float) = @_; |
13
|
|
|
|
|
|
|
|
14
|
24
|
|
|
|
|
42
|
my $int = int $float; |
15
|
24
|
|
|
|
|
37
|
my $fraction = $float - $int; |
16
|
|
|
|
|
|
|
|
17
|
24
|
|
|
|
|
119
|
return pack _TEMPLATE(), $int, ( $fraction * _NANO() ); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub to_float { |
21
|
8
|
|
|
8
|
0
|
13
|
my ($str) = @_; |
22
|
|
|
|
|
|
|
|
23
|
8
|
|
|
|
|
19
|
my ( $secs, $nsecs ) = unpack _TEMPLATE(), $str; |
24
|
|
|
|
|
|
|
|
25
|
8
|
|
|
|
|
29
|
return $secs + ( $nsecs / _NANO() ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |