From 989078e144024c50828fc7bccbaa63832733390e Mon Sep 17 00:00:00 2001 From: alegrand Date: Thu, 14 Apr 2005 21:34:27 +0000 Subject: [PATCH] moving timer functions so that we can use them for internals git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1215 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- include/xbt/sysdep.h | 7 ------- src/Makefile.am | 1 + src/gras/Virtu/rl_time.c | 13 ++----------- src/gras/Virtu/sg_chrono.c | 1 + src/xbt/sysdep.c | 1 + 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/include/xbt/sysdep.h b/include/xbt/sysdep.h index 4bd3cea284..b405a7afd2 100644 --- a/include/xbt/sysdep.h +++ b/include/xbt/sysdep.h @@ -91,13 +91,6 @@ static inline void *xbt_realloc(void*p,int s){ /** @} */ -/** @brief get time in seconds - - * gives the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970). - * Most users should use gras_os_time and should not use this function unless - they really know what they are doing. */ -double xbt_os_time(void); - END_DECL() #endif /* _XBT_SYSDEP_H */ diff --git a/src/Makefile.am b/src/Makefile.am index 9defdbda9b..24f1e181c5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,6 +41,7 @@ EXTRA_DIST= \ include/surf/surf.h \ include/surf/surf_parse.h \ \ + include/xbt/xbt_portability.h \ include/xbt/context.h \ \ msg/private.h \ diff --git a/src/gras/Virtu/rl_time.c b/src/gras/Virtu/rl_time.c index e9d07b29e3..b7e6292dfc 100644 --- a/src/gras/Virtu/rl_time.c +++ b/src/gras/Virtu/rl_time.c @@ -13,22 +13,13 @@ #include "xbt/sysdep.h" #include "gras/virtu.h" +#include "xbt/xbt_portability.h" /* private */ XBT_LOG_EXTERNAL_CATEGORY(virtu); XBT_LOG_DEFAULT_CATEGORY(virtu); double gras_os_time() { -#ifdef HAVE_GETTIMEOFDAY - struct timeval tv; - - gettimeofday(&tv, NULL); - - return (double)(tv.tv_sec + tv.tv_usec / 1000000.0); -#else - /* Poor resolution */ - return (double)(time(NULL)); -#endif /* HAVE_GETTIMEOFDAY? */ - + return xbt_os_time(); } void gras_os_sleep(double sec) { diff --git a/src/gras/Virtu/sg_chrono.c b/src/gras/Virtu/sg_chrono.c index 6ac5269fe4..9b16b28970 100644 --- a/src/gras/Virtu/sg_chrono.c +++ b/src/gras/Virtu/sg_chrono.c @@ -11,6 +11,7 @@ #include "xbt/dict.h" #include "gras/chrono.h" #include "msg/msg.h" +#include "xbt/xbt_portability.h" #include "portable.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(chrono,gras,"Benchmarking used code"); diff --git a/src/xbt/sysdep.c b/src/xbt/sysdep.c index 428d006728..d4199cedb0 100644 --- a/src/xbt/sysdep.c +++ b/src/xbt/sysdep.c @@ -10,6 +10,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "xbt/sysdep.h" +#include "xbt/xbt_portability.h" /* private */ #include "xbt/log.h" #include "xbt/error.h" #include "portable.h" -- 2.20.1