nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests & lib/realtime: rewrite test as a nitunit
[nit.git]
/
lib
/
realtime.nit
diff --git
a/lib/realtime.nit
b/lib/realtime.nit
index
5a9571d
..
243b5d8
100644
(file)
--- a/
lib/realtime.nit
+++ b/
lib/realtime.nit
@@
-120,6
+120,20
@@
extern class Timespec `{struct timespec*`}
end
# Keeps track of real time
end
# Keeps track of real time
+#
+# ~~~
+# var clock = new Clock
+#
+# # sleeping at least 1s
+# 1.0.sleep
+# assert clock.total >= 1.0
+# assert clock.lapse >= 1.0
+#
+# # sleeping at least 5ms
+# 0.005.sleep
+# assert clock.total >= 1.005
+# assert clock.lapse >= 0.005
+# ~~~
class Clock
super FinalizableOnce
class Clock
super FinalizableOnce