diff options
author | Uros Majstorovic <majstor@majstor.org> | 2022-02-02 06:40:10 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2022-02-02 06:40:10 +0100 |
commit | 64b55e7e1236121ea4197d9a37cfec43b196cfe8 (patch) | |
tree | eb16f4a2d3eae3d9485eccbd923812a56b627979 /ecp/src/platform/posix/time.c | |
parent | a4401c99c2a54ba9a964317cbff915d40d16e470 (diff) |
moved ecp, platform -> src
Diffstat (limited to 'ecp/src/platform/posix/time.c')
-rw-r--r-- | ecp/src/platform/posix/time.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ecp/src/platform/posix/time.c b/ecp/src/platform/posix/time.c new file mode 100644 index 0000000..111e598 --- /dev/null +++ b/ecp/src/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 |