nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
134ee7b
)
lib/realtime: intro `Clock::peek_lapse`
author
Alexis Laferrière
<alexis.laf@xymus.net>
Fri, 12 Jun 2015 21:12:55 +0000
(17:12 -0400)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Sat, 21 May 2016 15:03:27 +0000
(11:03 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/realtime.nit
patch
|
blob
|
history
diff --git
a/lib/realtime.nit
b/lib/realtime.nit
index
8cfa4da
..
523f63e
100644
(file)
--- a/
lib/realtime.nit
+++ b/
lib/realtime.nit
@@
-156,4
+156,15
@@
class Clock
time_at_last_lapse = nt
return dt
end
+
+ # Seconds since the last call to `lapse`, without resetting the lapse counter
+ fun peek_lapse: Float
+ do
+ var nt = new Timespec.monotonic_now
+ var dt = nt - time_at_last_lapse
+ var r = dt.to_f
+ nt.free
+ dt.free
+ return r
+ end
end