Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fixed smpi gettimeofday -- usecs should always be normalized to a value between
authorMark Stillwell <mark.stillwell@ens-lyon.fr>
Wed, 12 Oct 2011 11:50:06 +0000 (13:50 +0200)
committerMark Stillwell <mark.stillwell@ens-lyon.fr>
Wed, 12 Oct 2011 11:50:06 +0000 (13:50 +0200)
0 and 999999.

src/smpi/smpi_bench.c

index 195aa72..a6e7b63 100644 (file)
@@ -178,10 +178,9 @@ unsigned int smpi_sleep(unsigned int secs)
 int smpi_gettimeofday(struct timeval *tv, struct timezone *tz)
 {
   double now = SIMIX_get_clock();
-
   if (tv) {
     tv->tv_sec = (time_t) now;
-    tv->tv_usec = (suseconds_t) (now * 1e6);
+    tv->tv_usec = (suseconds_t)((now - tv->tv_sec) * 1e6);
   }
   return 0;
 }