Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move private declarations to private header
[simgrid.git] / src / xbt / sysdep.c
1 /* $Id$ */
2
3 /* sysdep.c -- all system dependency                                        */
4 /*  no system header should be loaded out of this file so that we have only */
5 /*  one file to check when porting to another OS                            */
6
7 /* Copyright (c) 2004 Martin Quinson. All rights reserved.                  */
8
9 /* This program is free software; you can redistribute it and/or modify it
10  * under the terms of the license (GNU LGPL) which comes with this package. */
11
12 #include "xbt/sysdep.h"
13 #include "xbt/xbt_portability.h" /* private */
14 #include "xbt/log.h"
15 #include "xbt/error.h"
16 #include "portable.h"
17
18 /* \defgroup XBT_sysdep All system dependency
19  * \brief This section describes many macros/functions that can serve as
20  *  an OS abstraction.
21  */
22
23 double xbt_os_time(void) {
24 #ifdef HAVE_GETTIMEOFDAY
25   struct timeval tv;
26
27   gettimeofday(&tv, NULL);
28
29   return (double)(tv.tv_sec + tv.tv_usec / 1000000.0);
30 #else
31   /* Poor resolution */
32   return (double)(time(NULL)); 
33 #endif /* HAVE_GETTIMEOFDAY? */         
34 }
35
36
37 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sysdep, xbt, "System dependency");
38