diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-08-09 23:20:06 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-08-09 23:20:06 -0400 |
commit | baf9ee660c9f1d44d64341e225f9e0d7b808424d (patch) | |
tree | dd77e67044ce5cca653306d48569bdfbbc81e91d /src/eval.c | |
parent | 9c74802117d97bdb55be08a954319e1b8733cb9d (diff) | |
download | bfs-baf9ee660c9f1d44d64341e225f9e0d7b808424d.tar.xz |
xtime: Remove xgettime()
clock_gettime() is available everywhere by now.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -1014,25 +1014,20 @@ bool eval_xtype(const struct bfs_expr *expr, struct bfs_eval *state) { } } -#if _POSIX_MONOTONIC_CLOCK > 0 -# define BFS_CLOCK CLOCK_MONOTONIC -#elif _POSIX_TIMERS > 0 -# define BFS_CLOCK CLOCK_REALTIME -#endif - /** - * Call clock_gettime(), if available. + * clock_gettime() wrapper. */ static int eval_gettime(struct bfs_eval *state, struct timespec *ts) { -#ifdef BFS_CLOCK - int ret = clock_gettime(BFS_CLOCK, ts); +#if _POSIX_MONOTONIC_CLOCK > 0 + int ret = clock_gettime(CLOCK_MONOTONIC, ts); +#else + int ret = clock_gettime(CLOCK_REALTIME, ts); +#endif + if (ret != 0) { bfs_warning(state->ctx, "%pP: clock_gettime(): %s.\n", state->ftwbuf, errstr()); } return ret; -#else - return -1; -#endif } /** |