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
Fix regression tests
[simgrid.git]
/
src
/
xbt
/
xbt_os_time.c
diff --git
a/src/xbt/xbt_os_time.c
b/src/xbt/xbt_os_time.c
index b80030cbbb68253c47b30d95b6eb824ebf834c60..4c5b696bdc61c923448442e5ece4943c9e2707b2 100644
(file)
--- a/
src/xbt/xbt_os_time.c
+++ b/
src/xbt/xbt_os_time.c
@@
-1,6
+1,6
@@
/* xbt_os_time.c -- portable interface to time-related functions */
/* xbt_os_time.c -- portable interface to time-related functions */
-/* Copyright (c) 2007-202
0
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-202
2
. The SimGrid Team. All rights reserved. */
/* 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. */
/* 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. */
@@
-80,7
+80,7
@@
double xbt_os_time(void)
return (double) (time(NULL));
#endif /* HAVE_GETTIMEOFDAY? */
return (double) (time(NULL));
#endif /* HAVE_GETTIMEOFDAY? */
- return
tv.tv_sec + tv.tv_usec / 1000000.0
;
+ return
(double)tv.tv_sec + (double)tv.tv_usec / 1e6
;
}
void xbt_os_sleep(double sec)
}
void xbt_os_sleep(double sec)
@@
-91,14
+91,14
@@
void xbt_os_sleep(double sec)
#elif HAVE_NANOSLEEP
struct timespec ts;
#elif HAVE_NANOSLEEP
struct timespec ts;
- ts.tv_sec
=
sec;
- ts.tv_nsec = (
sec - floor(sec)) * 1e9
;
+ ts.tv_sec
= (time_t)
sec;
+ ts.tv_nsec = (
long)((sec - floor(sec)) * 1e9)
;
nanosleep (&ts, NULL);
#else /* don't have nanosleep. Use select to sleep less than one second */
struct timeval timeout;
nanosleep (&ts, NULL);
#else /* don't have nanosleep. Use select to sleep less than one second */
struct timeval timeout;
- timeout.tv_sec
= (unsigned long) (sec)
;
- timeout.tv_usec = (
sec - floor(sec)) * 1000000
;
+ timeout.tv_sec
= (long)sec
;
+ timeout.tv_usec = (
long)(sec - floor(sec)) * 1e6)
;
select(0, NULL, NULL, NULL, &timeout);
#endif
select(0, NULL, NULL, NULL, &timeout);
#endif