From 76ccdb41d4d6d31d90ca5187a609afaf50122579 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 24 Oct 2023 18:38:58 +0200 Subject: [PATCH] Typo + cosmetics in portability helpers Who's using a system without gettimeofday anyway? --- src/xbt/xbt_os_time.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xbt/xbt_os_time.c b/src/xbt/xbt_os_time.c index b6a16ad27f..f0d5401389 100644 --- a/src/xbt/xbt_os_time.c +++ b/src/xbt/xbt_os_time.c @@ -40,11 +40,11 @@ double xbt_os_time(void) #if HAVE_GETTIMEOFDAY struct timeval tv; gettimeofday(&tv, NULL); + + return (double)tv.tv_sec + (double)tv.tv_usec / 1e6; #else /* no gettimeofday => poor resolution */ return (double) (time(NULL)); #endif /* HAVE_GETTIMEOFDAY? */ - - return (double)tv.tv_sec + (double)tv.tv_usec / 1e6; } void xbt_os_sleep(double sec) @@ -59,7 +59,7 @@ void xbt_os_sleep(double sec) struct timeval timeout; timeout.tv_sec = (long)sec; - timeout.tv_usec = (long)(sec - floor(sec)) * 1e6); + timeout.tv_usec = (long)(sec - floor(sec)) * 1e6; select(0, NULL, NULL, NULL, &timeout); #endif -- 2.20.1