Change in ...libosmocore[master]: TIMER constants not on some architectures

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Hoernchen gerrit-no-reply at lists.osmocom.org
Tue Jul 16 19:35:51 UTC 2019


Hello Ruben Undheim,

I'd like you to do a code review. Please visit

    https://gerrit.osmocom.org/c/libosmocore/+/14796

to review the following change.


Change subject: TIMER constants not on some architectures
......................................................................

TIMER constants not on some architectures

Change-Id: If24616c3dbf9f1eb6053caed90a63b590d3f5833
---
M src/timer_clockgettime.c
M tests/timer/clk_override_test.c
2 files changed, 17 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/96/14796/1

diff --git a/src/timer_clockgettime.c b/src/timer_clockgettime.c
index 7b17fd1..b610b30 100644
--- a/src/timer_clockgettime.c
+++ b/src/timer_clockgettime.c
@@ -75,20 +75,26 @@
 	switch(clk_id) {
 	case CLOCK_REALTIME:
 		return &realtime;
-	case CLOCK_REALTIME_COARSE:
-		return &realtime_coarse;
 	case CLOCK_MONOTONIC:
 		return &mono;
-	case CLOCK_MONOTONIC_COARSE:
-		return &mono_coarse;
-	case CLOCK_MONOTONIC_RAW:
-		return &mono_raw;
-	case CLOCK_BOOTTIME:
-		return &boottime;
 	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;
+#endif
 	default:
 		return NULL;
 	}
diff --git a/tests/timer/clk_override_test.c b/tests/timer/clk_override_test.c
index 308e821..73673a2 100644
--- a/tests/timer/clk_override_test.c
+++ b/tests/timer/clk_override_test.c
@@ -40,12 +40,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);

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14796
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If24616c3dbf9f1eb6053caed90a63b590d3f5833
Gerrit-Change-Number: 14796
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Ruben Undheim <ruben.undheim at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190716/ec0589be/attachment.htm>


More information about the gerrit-log mailing list