summaryrefslogtreecommitdiff
path: root/src/time/time.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-08 18:42:39 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-08 18:42:39 -0500
commit7ef8a7379f7f7d09e71ccae2a0b688c3cd80423f (patch)
tree092ab0aed1769117fd7b28b8592f6f96b0e0d5af /src/time/time.c
parent6acf19370e8adff79cd83b257d3f04aeaf2a59dd (diff)
merge sources into single tree
Diffstat (limited to 'src/time/time.c')
-rw-r--r--src/time/time.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/time/time.c b/src/time/time.c
new file mode 100644
index 00000000..abe47471
--- /dev/null
+++ b/src/time/time.c
@@ -0,0 +1,31 @@
+#include <time.h>
+#include "nonstd/internal.h"
+#include "nonstd/syscall.h"
+
+/** get current time **/
+
+time_t time(time_t * timer)
+{
+ long int now;
+ SYSCALL_NUMBER(sc, "time", 0);
+
+ now = __syscall(sc);
+
+ if (timer != NULL && now != -1) {
+ *timer = (time_t)now;
+ }
+
+ return (time_t)now;
+}
+
+/***
+gets the current time. If ARGUMENT(timer) is not CONSTANT(NULL),
+the current time is also stored in the object it points to.
+***/
+
+/*
+UNSPECIFIED(The encoding of TYPEDEF(time_t))
+RETURN_FAILURE(CAST(TYPEDEF(time_t), -1))
+RETURN_SUCCESS(the current calndar time)
+STDC(1)
+*/