Skip to content
This repository was archived by the owner on Aug 19, 2021. It is now read-only.

Commit 2cd841c

Browse files
committed
Consolidated on gettimeofday for posix tick implementation
Despite being marked as obselete, gettimeofday remains the better supported posix api. A more portable library would conditionally switch between the two, but for now supported both implementations has little benefit.
1 parent d823d44 commit 2cd841c

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

events_posix.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,16 @@
1111
#include "events_mutex.h"
1212

1313
#include <time.h>
14+
#include <sys/time.h>
1415

1516

1617
// Tick operations
17-
#ifdef _POSIX_TIMERS
18-
19-
unsigned events_tick(void) {
20-
struct timespec ts;
21-
clock_gettime(CLOCK_MONOTONIC, &ts);
22-
return (unsigned)(ts.tv_sec*1000 + ts.tv_nsec/1000000);
23-
}
24-
25-
#else
26-
#include <sys/time.h>
27-
2818
unsigned events_tick(void) {
2919
struct timeval tv;
3020
gettimeofday(&tv, 0);
3121
return (unsigned)(tv.tv_sec*1000 + tv.tv_usec/1000);
3222
}
3323

34-
#endif
35-
3624

3725
// Mutex operations
3826
int events_mutex_create(events_mutex_t *m) {

0 commit comments

Comments
 (0)