A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tsss... :)
[simgrid.git]
/
src
/
gras
/
Virtu
/
rl_time.c
diff --git
a/src/gras/Virtu/rl_time.c
b/src/gras/Virtu/rl_time.c
index
c65d261
..
eeb782b
100644
(file)
--- a/
src/gras/Virtu/rl_time.c
+++ b/
src/gras/Virtu/rl_time.c
@@
-2,24
+2,32
@@
/* time - time related syscal wrappers */
/* time - time related syscal wrappers */
-/* Authors: Martin Quinson */
-/* Copyright (C) 2003,2004 da GRAS posse. */
+/* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
/* This program is free software; you can redistribute it and/or modify it
-
under the terms of the license (GNU LGPL) which comes with this package. */
+
*
under the terms of the license (GNU LGPL) which comes with this package. */
-#include "gras_private.h"
-#include <sys/time.h> /* gettimeofday() */
+#include "portable.h"
-double gras_time() {
+#include "xbt/sysdep.h"
+#include "gras/virtu.h"
+
+
+double gras_os_time() {
+#ifdef HAVE_GETTIMEOFDAY
struct timeval tv;
gettimeofday(&tv, NULL);
struct timeval tv;
gettimeofday(&tv, NULL);
- return (double)(tv.tv_sec * 1000000 + tv.tv_usec);
+ return (double)(tv.tv_sec + tv.tv_usec / 1000000.0);
+#else
+ /* Poor resolution */
+ return (double)(time(NULL));
+#endif /* HAVE_GETTIMEOFDAY? */
+
}
}
-void gras_sleep(unsigned long sec,unsigned long usec) {
+void gras_
os_
sleep(unsigned long sec,unsigned long usec) {
sleep(sec);
if (usec/1000000) sleep(usec/1000000);
sleep(sec);
if (usec/1000000) sleep(usec/1000000);