compsci 0.3.2.3 → 0.3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/compsci/timer.rb +7 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6988acf55d6b28d2e24ba9ac8d549287bc841d2be362293a000ffadf3e75c77
|
4
|
+
data.tar.gz: b5f95b5678b3e509d5097e96727994451952cd52aa32ef0a628f383ee924af20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dade867140e16eb11f9092e87c7a464a580ae96e2f01902e155ea24f7a0247379ff355d16cd58a8a0dd2ed21a9c725a99fce649f91d3b0e0ed8a03e7d83f6b95
|
7
|
+
data.tar.gz: f698945fd3d66d07a239162bfca91c5b7201f26f8353e27882139e048c6110c8134f3206a827d171873792937d55ae3f777124893a356f9c4c66aaac51d0fae1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.2.
|
1
|
+
0.3.2.4
|
data/lib/compsci/timer.rb
CHANGED
@@ -38,7 +38,7 @@ module CompSci
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# YYYY-MM-DD HH::MM::SS.mmm
|
41
|
-
def self.timestamp(t)
|
41
|
+
def self.timestamp(t = Time.now)
|
42
42
|
t.strftime "%Y-%m-%d %H:%M:%S.%L"
|
43
43
|
end
|
44
44
|
|
@@ -57,7 +57,7 @@ module CompSci
|
|
57
57
|
hmsms.join('.')
|
58
58
|
end
|
59
59
|
|
60
|
-
def restart(t =
|
60
|
+
def restart(t = Timer.now)
|
61
61
|
@start = t
|
62
62
|
self
|
63
63
|
end
|
@@ -71,25 +71,25 @@ module CompSci
|
|
71
71
|
puts '-' * 70, timestamp(t), '-' * 70
|
72
72
|
end
|
73
73
|
|
74
|
-
def elapsed(t =
|
74
|
+
def elapsed(t = Timer.now)
|
75
75
|
t - @start
|
76
76
|
end
|
77
77
|
|
78
|
-
def elapsed_ms(t =
|
78
|
+
def elapsed_ms(t = Timer.now)
|
79
79
|
elapsed(t) * 1000
|
80
80
|
end
|
81
81
|
|
82
|
-
def elapsed_display(t =
|
82
|
+
def elapsed_display(t = Timer.now)
|
83
83
|
self.class.elapsed_display(elapsed_ms(t))
|
84
84
|
end
|
85
85
|
alias_method :to_s, :elapsed_display
|
86
86
|
alias_method :inspect, :elapsed_display
|
87
87
|
|
88
|
-
def stamp(msg = '', t =
|
88
|
+
def stamp(msg = '', t = Timer.now)
|
89
89
|
format("%s %s", elapsed_display(t), msg)
|
90
90
|
end
|
91
91
|
|
92
|
-
def stamp!(msg = '', t =
|
92
|
+
def stamp!(msg = '', t = Timer.now)
|
93
93
|
puts stamp(msg, t)
|
94
94
|
end
|
95
95
|
end
|