line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright © 2015 David Caldwell . |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or modify |
4
|
|
|
|
|
|
|
# it under the same terms as Perl itself, either Perl version 5.12.4 or, |
5
|
|
|
|
|
|
|
# at your option, any later version of Perl 5 you may have available. |
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
90866
|
use strict; use warnings; |
|
4
|
|
|
4
|
|
8
|
|
|
4
|
|
|
|
|
148
|
|
|
4
|
|
|
|
|
17
|
|
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
178
|
|
8
|
|
|
|
|
|
|
package Time::Monotonic; |
9
|
4
|
|
|
4
|
|
14
|
use Exporter 'import'; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
759
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw(monotonic_time); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = 'v0.9.8'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
require XSLoader; |
15
|
|
|
|
|
|
|
XSLoader::load('Time::Monotonic', $VERSION); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub monotonic_time { |
18
|
9
|
|
|
9
|
1
|
1559
|
Time::Monotonic::clock_get_dbl(); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub backend { |
22
|
1
|
|
|
1
|
1
|
19
|
Time::Monotonic::monotonic_clock_name(); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub is_monotonic { |
26
|
1
|
|
|
1
|
1
|
8
|
Time::Monotonic::monotonic_clock_is_monotonic(); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
3
|
|
|
3
|
0
|
362
|
my ($class, $offset) = @_; |
31
|
3
|
|
100
|
|
|
6
|
my $now = monotonic_time() + ($offset || 0); |
32
|
3
|
|
33
|
|
|
15
|
bless \$now => ref $class || $class; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub now { |
36
|
4
|
|
|
4
|
0
|
3597
|
my $self = shift; |
37
|
4
|
|
|
|
|
8
|
return monotonic_time() - $$self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
__END__ |