time: don't try to use the coarse clock
authorBjörn Jacke <bj@sernet.de>
Wed, 3 Jul 2013 16:51:14 +0000 (18:51 +0200)
committerSimo Sorce <idra@samba.org>
Fri, 5 Jul 2013 12:54:53 +0000 (08:54 -0400)
as we prefer to use the suspend aware CLOCK_BOOTTIME as monotonic clock source
we cannot deal with the mono coarse clock any more. Actually I never saw a real
performance gain with it.

Signed-off-by: Björn Jacke <bj@sernet.de>
Reviewed-by: Simo Sorce <idra@samba.org>
lib/util/time.c

index 56b2ec50dec1a9bc53891fcea65fd991a0807f97..bc8712085931f9a2f383863f074417706f342899 100644 (file)
@@ -69,19 +69,12 @@ _PUBLIC_ void clock_gettime_mono(struct timespec *tp)
 
 /**
 a wrapper to preferably get the monotonic time in seconds
-as this is only second resolution we can use the cached
-(and much faster) COARSE clock variant
 **/
 _PUBLIC_ time_t time_mono(time_t *t)
 {
        struct timespec tp;
-       int rc = -1;
-#ifdef CLOCK_MONOTONIC_COARSE
-       rc = clock_gettime(CLOCK_MONOTONIC_COARSE,&tp);
-#endif
-       if (rc != 0) {
-               clock_gettime_mono(&tp);
-       }
+
+       clock_gettime_mono(&tp);
        if (t != NULL) {
                *t = tp.tv_sec;
        }