X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8c354c48ec90c997cc7213ce96ca97d882934166..989078e144024c50828fc7bccbaa63832733390e:/src/xbt/sysdep.c diff --git a/src/xbt/sysdep.c b/src/xbt/sysdep.c index b1dd0d294a..d4199cedb0 100644 --- a/src/xbt/sysdep.c +++ b/src/xbt/sysdep.c @@ -1,6 +1,6 @@ /* $Id$ */ -/* gras/sysdep.h -- all system dependency */ +/* sysdep.c -- all system dependency */ /* no system header should be loaded out of this file so that we have only */ /* one file to check when porting to another OS */ @@ -10,17 +10,29 @@ * 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" -#include +/* \defgroup XBT_sysdep All system dependency + * \brief This section describes many macros/functions that can serve as + * an OS abstraction. + */ -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sysdep, xbt, "System dependency"); +double xbt_os_time(void) { +#ifdef HAVE_GETTIMEOFDAY + struct timeval tv; -/**** - **** Misc - ****/ + gettimeofday(&tv, NULL); -void xbt_abort(void) { - abort(); + return (double)(tv.tv_sec + tv.tv_usec / 1000000.0); +#else + /* Poor resolution */ + return (double)(time(NULL)); +#endif /* HAVE_GETTIMEOFDAY? */ } + + +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sysdep, xbt, "System dependency"); +