lib: update the time module to the light FFI
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 16 Jun 2015 17:58:19 +0000 (13:58 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 16 Jun 2015 18:03:49 +0000 (14:03 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/standard/time.nit
lib/standard/time_nit.c [deleted file]
lib/standard/time_nit.h [deleted file]

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
diff --git a/lib/standard/time_nit.c b/lib/standard/time_nit.c
deleted file mode 100644 (file)
index ca025fb..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2008 Floréal Morandat <morandat@lirmm.fr> 
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A 
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "time_nit.h"
-
-void std_nanosleep_(long sec,long nanosec) {
-       const struct timespec req = {sec, nanosec};
-       nanosleep(&req, NULL);
-}
diff --git a/lib/standard/time_nit.h b/lib/standard/time_nit.h
deleted file mode 100644 (file)
index ea4a210..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __TIME_NIT_H
-#define __TIME_NIT_H
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2008 Floréal Morandat <morandat@lirmm.fr> 
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A 
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include <time.h>
-#define kernel_Any_Any_get_time_0(self) time(NULL)
-#define std_nanosleep(self, sec, nanosec) std_nanosleep_(sec, nanosec);
-void std_nanosleep_(long sec, long nanosec);
-#endif