nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
81dcb99
)
lib/core/time: also sleep on integers
author
Alexandre Terrasa
<alexandre@moz-code.org>
Fri, 12 May 2017 00:08:19 +0000
(20:08 -0400)
committer
Alexandre Terrasa
<alexandre@moz-code.org>
Fri, 12 May 2017 00:08:19 +0000
(20:08 -0400)
It always bothered me to write `1.0.sleep`...
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
lib/core/time.nit
patch
|
blob
|
history
diff --git
a/lib/core/time.nit
b/lib/core/time.nit
index
83ddf5c
..
e5248d9
100644
(file)
--- a/
lib/core/time.nit
+++ b/
lib/core/time.nit
@@
-51,6
+51,13
@@
redef class Sys
`}
end
+redef class Int
+ # Sleep approximately `self` seconds
+ #
+ # Is not interrupted by signals.
+ fun sleep do to_f.sleep
+end
+
redef class Float
# Sleep approximately `self` seconds
#