[PATCH weston] compositor/clients: Protect CLOCK_BOOTTIME with ifdefs

Derek Foreman derekf at osg.samsung.com
Mon Jun 29 11:20:34 PDT 2015


CLOCK_BOOTTIME is a relatively new* feature that may not actually be
present everywhere (I'm looking at you wheezy).  Since our use of it
is actually only cosmetic, I've just ifdef'd if.

* No it isn't.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---

Theoretically, this could bite us if a new clock type is added and it's
present but CLOCK_BOOTTIME isn't on a system somewhere.  At that point
we'll probably have to consider moving from a sparse array to something
more robust...

 clients/weston-info.c | 2 ++
 src/compositor.c      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/clients/weston-info.c b/clients/weston-info.c
index 89ef8f1..f22781c 100644
--- a/clients/weston-info.c
+++ b/clients/weston-info.c
@@ -579,7 +579,9 @@ clock_name(clockid_t clk_id)
 		[CLOCK_MONOTONIC_RAW] =		"CLOCK_MONOTONIC_RAW",
 		[CLOCK_REALTIME_COARSE] =	"CLOCK_REALTIME_COARSE",
 		[CLOCK_MONOTONIC_COARSE] =	"CLOCK_MONOTONIC_COARSE",
+#ifdef CLOCK_BOOTTIME
 		[CLOCK_BOOTTIME] =		"CLOCK_BOOTTIME",
+#endif
 	};
 
 	if (clk_id < 0 || (unsigned)clk_id >= ARRAY_LENGTH(names))
diff --git a/src/compositor.c b/src/compositor.c
index 1e09163..6156ea1 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -4760,7 +4760,9 @@ clock_name(clockid_t clk_id)
 		[CLOCK_MONOTONIC_RAW] =		"CLOCK_MONOTONIC_RAW",
 		[CLOCK_REALTIME_COARSE] =	"CLOCK_REALTIME_COARSE",
 		[CLOCK_MONOTONIC_COARSE] =	"CLOCK_MONOTONIC_COARSE",
+#ifdef CLOCK_BOOTTIME
 		[CLOCK_BOOTTIME] =		"CLOCK_BOOTTIME",
+#endif
 	};
 
 	if (clk_id < 0 || (unsigned)clk_id >= ARRAY_LENGTH(names))
-- 
2.1.4



More information about the wayland-devel mailing list