From f8176b699b31f87d685bc575e715f68bae87a121 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 16 May 2018 12:28:42 +0100 Subject: [PATCH] clock: prefer clock monotonic Various articles claim that CLOCK_MONOTONIC is actually faster than the CLOCK_MONOTONIC_RAW, and that seems to be my experience. --- lib/sp-clock.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/sp-clock.c b/lib/sp-clock.c index 1de32277..48cc9c31 100644 --- a/lib/sp-clock.c +++ b/lib/sp-clock.c @@ -24,18 +24,17 @@ void sp_clock_init (void) { static const gint clock_ids[] = { + CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_COARSE, - CLOCK_MONOTONIC, CLOCK_REALTIME_COARSE, CLOCK_REALTIME, }; - guint i; if (sp_clock != -1) return; - for (i = 0; i < G_N_ELEMENTS (clock_ids); i++) + for (guint i = 0; i < G_N_ELEMENTS (clock_ids); i++) { struct timespec ts; int clock_id = clock_ids [i];