s4/ldb: use monotonic clock for time deltas in ldbtest
authorBjörn Jacke <bj@sernet.de>
Mon, 30 Aug 2010 16:54:42 +0000 (18:54 +0200)
committerBjörn Jacke <bj@sernet.de>
Tue, 31 Aug 2010 08:26:36 +0000 (10:26 +0200)
source4/lib/ldb/tools/ldbtest.c

index b76889c61fbdf3b8d367071ca1c60dd90ee111dc..a885b80c72695a7be2e210d7b4bc04f51b2c2214 100644 (file)
 #include "ldb.h"
 #include "tools/cmdline.h"
 
-static struct timeval tp1,tp2;
+static struct timespec tp1,tp2;
 static struct ldb_cmdline *options;
 
 static void _start_timer(void)
 {
-       gettimeofday(&tp1,NULL);
+       clock_gettime_mono(&tp1);
 }
 
 static double _end_timer(void)
 {
-       gettimeofday(&tp2,NULL);
+       clock_gettime_mono(&tp2);
        return((tp2.tv_sec - tp1.tv_sec) + 
-              (tp2.tv_usec - tp1.tv_usec)*1.0e-6);
+              (tp2.tv_nsec - tp1.tv_nsec)*1.0e-9);
 }
 
 static void add_records(struct ldb_context *ldb,