]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
Change DT_Mdep_GetTime to use gettimeofday() which has more resolution
authorArlin Davis <arlin.r.davis@intel.com>
Tue, 2 Oct 2007 18:43:34 +0000 (11:43 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Tue, 2 Oct 2007 18:43:34 +0000 (11:43 -0700)
than times().

Signed-off-by: Anton Blanchard <anton@samba.org>
test/dapltest/mdep/linux/dapl_mdep_user.c

index 91e45b9f5d56788e99b2b01f8f297bdea9b0f2f6..491ead1e2dbebe0daaaa2c439b8b68e8646287e8 100644 (file)
@@ -176,9 +176,9 @@ DT_Mdep_GetCpuStat (
 unsigned long
 DT_Mdep_GetTime (void)
 {
-    struct tms      ts;
-    clock_t         t = times (&ts);
-    return (unsigned long) ((DAT_UINT64) t * 1000 / CLOCKS_PER_SEC);
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    return tv.tv_sec * 1000 + tv.tv_usec / 1000;
 }
 
 double