sus 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/sus/clock.rb +21 -10
- data/lib/sus/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f878b94ac4b8236fdb411866336061b34cca3c59a9573e4cb0ef238d545ffe3d
|
4
|
+
data.tar.gz: c61aaee1228f6ab7796811ee739de195a5b59cf1a014f304d08f3d64488c94ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 181ee960cee58bf710d7de09a6f83f72a71f01d25716d18dd386562bf2984e14f690cfa1561b298d36bc068d06676481979866f48ee2a2716866e725a9d3c07f
|
7
|
+
data.tar.gz: 206fa66d07315578142b07b3802a66af629668502a2745dbf4a3f60cbebf4c8d8cc8c2edd4011397a22b7d039c753874409fe576d42890745629d4d5ac57a906
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/sus/clock.rb
CHANGED
@@ -15,23 +15,33 @@ module Sus
|
|
15
15
|
@duration = duration
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
def duration
|
19
|
+
if @start_time
|
20
|
+
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
21
|
+
@duration += now - @start_time
|
22
|
+
@start_time = now
|
23
|
+
end
|
24
|
+
|
25
|
+
return @duration
|
26
|
+
end
|
19
27
|
|
20
28
|
def <=>(other)
|
21
|
-
|
29
|
+
duration <=> other.to_f
|
22
30
|
end
|
23
31
|
|
24
32
|
def to_f
|
25
|
-
|
33
|
+
duration
|
26
34
|
end
|
27
35
|
|
28
36
|
def to_s
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
"#{(
|
37
|
+
duration = self.duration
|
38
|
+
|
39
|
+
if duration < 0.001
|
40
|
+
"#{(duration * 1_000_000).round(1)}µs"
|
41
|
+
elsif duration < 1.0
|
42
|
+
"#{(duration * 1_000).round(1)}ms"
|
33
43
|
else
|
34
|
-
"#{
|
44
|
+
"#{duration.round(1)}s"
|
35
45
|
end
|
36
46
|
end
|
37
47
|
|
@@ -41,11 +51,12 @@ module Sus
|
|
41
51
|
|
42
52
|
def stop!
|
43
53
|
if @start_time
|
44
|
-
|
54
|
+
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
55
|
+
@duration += now - @start_time
|
45
56
|
@start_time = nil
|
46
57
|
end
|
47
58
|
|
48
|
-
return
|
59
|
+
return duration
|
49
60
|
end
|
50
61
|
end
|
51
62
|
end
|
data/lib/sus/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|