nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: update the time module to the light FFI
[nit.git]
/
lib
/
standard
/
time.nit
diff --git
a/lib/standard/time.nit
b/lib/standard/time.nit
index
260f44c
..
adac6ff
100644
(file)
--- a/
lib/standard/time.nit
+++ b/
lib/standard/time.nit
@@
-23,12
+23,15
@@
in "C Header" `{
redef class Object
# Unix time: the number of seconds elapsed since January 1, 1970
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
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
end
# Time since epoch