lib/core/time: also sleep on integers
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 12 May 2017 00:08:19 +0000 (20:08 -0400)
committerAlexandre 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

index 83ddf5c..e5248d9 100644 (file)
@@ -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
        #