summaryrefslogtreecommitdiff
path: root/ecp/platform/posix/time.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-01-31 07:53:13 +0100
committerUros Majstorovic <majstor@majstor.org>2022-01-31 07:53:13 +0100
commit0eaf514b1f97cb1587815104477e43c50a3eebe6 (patch)
treee139a31e8e6360adbe93c9322bec7f6edabfdd19 /ecp/platform/posix/time.c
parentdd19d6f5c7e0b335301a3f3e3d21bffb8c83e558 (diff)
fixed build sys
Diffstat (limited to 'ecp/platform/posix/time.c')
-rw-r--r--ecp/platform/posix/time.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/ecp/platform/posix/time.c b/ecp/platform/posix/time.c
new file mode 100644
index 0000000..111e598
--- /dev/null
+++ b/ecp/platform/posix/time.c
@@ -0,0 +1,24 @@
+#include <unistd.h>
+#include <sys/time.h>
+
+#include <core.h>
+#include <tm.h>
+
+int ecp_tm_init(ECPContext *ctx) {
+ return ECP_OK;
+}
+
+ecp_cts_t ecp_tm_abstime_ms(ecp_cts_t msec) {
+ struct timeval tv;
+ ecp_cts_t ms_now;
+
+ gettimeofday(&tv, NULL);
+ ms_now = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ return ms_now + msec;
+}
+
+void ecp_tm_sleep_ms(ecp_cts_t msec) {
+ usleep(msec*1000);
+}
+
+void ecp_tm_timer_set(ecp_cts_t next) {} \ No newline at end of file