From: mquinson Date: Mon, 6 Jun 2005 20:56:15 +0000 (+0000) Subject: let timer work on host without gettimeofday (windows comes to mind) X-Git-Tag: v3.3~4002 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ba0ca547e30986d4a982dab79ed6aaadc139ff9f?hp=b8263c9bbadaf1ab49982051c234d404c53dd69e let timer work on host without gettimeofday (windows comes to mind) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1353 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/xbt/sysdep.c b/src/xbt/sysdep.c index 6f6aea8b8a..58bdb0f643 100644 --- a/src/xbt/sysdep.c +++ b/src/xbt/sysdep.c @@ -70,7 +70,11 @@ void xbt_os_timer_stop(xbt_os_timer_t timer) { #endif } double xbt_os_timer_elapsed(xbt_os_timer_t timer) { +#ifdef HAVE_GETTIMEOFDAY return ((double)timer->stop.tv_sec) - ((double)timer->start.tv_sec) + ((((double)timer->stop.tv_usec) - ((double)timer->start.tv_usec)) / 1000000.0); +#else + return (double)timer->stop - (double)timer->start; +#endif }