lib: update the time module to the light FFI
[nit.git] / lib / standard / time.nit
index 260f44c..adac6ff 100644 (file)
@@ -23,12 +23,15 @@ in "C Header" `{
 
 redef class Object
        # Unix time: the number of seconds elapsed since January 1, 1970
-       protected fun get_time: Int is extern "kernel_Any_Any_get_time_0"
+       protected fun get_time: Int `{ return time(NULL); `}
 end
 
 redef class Sys
        # Wait a specific number of second and nanoseconds
-       fun nanosleep(sec, nanosec: Int) is extern "std_nanosleep"
+       fun nanosleep(sec, nanosec: Int) `{
+               const struct timespec req = {sec, nanosec};
+               nanosleep(&req, NULL);
+       `}
 end
 
 # Time since epoch