@@ -7,13 +7,13 @@ module Concurrent
7
7
8
8
if defined? ( Process ::CLOCK_MONOTONIC )
9
9
# @!visibility private
10
- def get_time ( since = 0.0 )
11
- Process . clock_gettime ( Process ::CLOCK_MONOTONIC ) - since . to_f
10
+ def get_time
11
+ Process . clock_gettime ( Process ::CLOCK_MONOTONIC )
12
12
end
13
13
elsif RUBY_PLATFORM == 'java'
14
14
# @!visibility private
15
- def get_time ( since = 0.0 )
16
- ( java . lang . System . nanoTime ( ) / 1_000_000_000.0 ) - since . to_f
15
+ def get_time
16
+ java . lang . System . nanoTime ( ) / 1_000_000_000.0
17
17
end
18
18
else
19
19
@@ -27,7 +27,7 @@ def initialize
27
27
end
28
28
29
29
# @!visibility private
30
- def get_time ( since = 0.0 )
30
+ def get_time
31
31
@mutex . synchronize {
32
32
@correction ||= 0 # compensating any back time shifts
33
33
now = Time . now . to_f
@@ -38,26 +38,21 @@ def get_time(since = 0.0)
38
38
@correction += @last_time - corrected_now + 0.000_001
39
39
@last_time = @correction + now
40
40
end
41
- } - since . to_f
41
+ }
42
42
end
43
43
end
44
44
} . new
45
45
46
46
# @!macro [attach] monotonic_get_time
47
47
#
48
48
# Returns the current time a tracked by the application monotonic clock.
49
- # When no `since` time is given the return value will bet he current time.
50
- # When an `since` value is given the return value will be the monotonic time
51
- # interval which has been passed since the `since` time.
52
49
#
53
- # @param [Float] since the monotonic time from which to calculate
54
- # the time interval
55
50
# @return [Float] The current monotonic time when `since` not given else
56
51
# the elapsed monotonic time between `since` and the current time
57
52
#
58
53
# @!macro monotonic_clock_warning
59
- def monotonic_time ( since = 0.0 )
60
- GLOBAL_MONOTONIC_CLOCK . get_time ( since )
54
+ def monotonic_time
55
+ GLOBAL_MONOTONIC_CLOCK . get_time
61
56
end
62
57
module_function :monotonic_time
63
58
end
0 commit comments