Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fixed smpi gettimeofday -- usecs should always be normalized to a value between
[simgrid.git] / src / smpi / smpi_bench.c
index e91f9c74824c6b39bc81006fcd287d2e132229cf..a6e7b631d5bbdb3fdf4533a42f784208e72cb099 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;
 }
@@ -368,7 +367,8 @@ int smpi_shared_known_call(const char* func, const char* input) {
    TRY {
       xbt_dict_get(calls, loc); /* Succeed or throw */
       known = 1;
-   } CATCH(ex) {
+   }
+   CATCH(ex) {
       if(ex.category == not_found_error) {
          known = 0;
          xbt_ex_free(ex);