From: Ruben Undheim Date: Sun, 18 Nov 2018 12:37:57 +0100 Subject: TIMER constants not on some architectures Forwarded: not-needed --- src/timer_clockgettime.c | 18 ++++++++++++------ tests/timer/clk_override_test.c | 3 +++ 2 files changed, 15 insertions(+), 6 deletions(-) --- a/tests/timer/clk_override_test.c +++ b/tests/timer/clk_override_test.c @@ -36,12 +36,15 @@ struct timespec read1, read2, res; struct timespec *mono; +#if defined(__GNU__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#else osmo_clock_gettime(CLOCK_BOOTTIME, &read1); usleep(500); osmo_clock_gettime(CLOCK_BOOTTIME, &read2); if (!timespeccmp(&read2, &read1, >)) return EXIT_FAILURE; printf("Non implemented clocks work fine\n"); +#endif osmo_clock_gettime(CLOCK_MONOTONIC, &read1); usleep(500); --- a/src/core/timer_clockgettime.c +++ b/src/core/timer_clockgettime.c @@ -71,20 +71,26 @@ switch(clk_id) { case CLOCK_REALTIME: return &realtime; - case CLOCK_REALTIME_COARSE: - return &realtime_coarse; case CLOCK_MONOTONIC: return &mono; + case CLOCK_PROCESS_CPUTIME_ID: + return &proc_cputime_id; + case CLOCK_THREAD_CPUTIME_ID: + return &th_cputime_id; +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#else + case CLOCK_REALTIME_COARSE: + return &realtime_coarse; case CLOCK_MONOTONIC_COARSE: return &mono_coarse; case CLOCK_MONOTONIC_RAW: return &mono_raw; +#endif +#if defined(__GNU__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#else case CLOCK_BOOTTIME: return &boottime; - case CLOCK_PROCESS_CPUTIME_ID: - return &proc_cputime_id; - case CLOCK_THREAD_CPUTIME_ID: - return &th_cputime_id; +#endif default: return NULL; }