projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[runtime] Initialize the class name cache using double checked locking.
[mono.git]
/
mono
/
io-layer
/
misc.c
diff --git
a/mono/io-layer/misc.c
b/mono/io-layer/misc.c
index 102798c7af54a7966e8393f65ab3abc61c61020c..82835cc52b937ac0598b8bdb4c66fed8d2bd9e9a 100644
(file)
--- a/
mono/io-layer/misc.c
+++ b/
mono/io-layer/misc.c
@@
-11,17
+11,20
@@
#include <glib.h>
#include <sys/time.h>
#include <stdlib.h>
#include <glib.h>
#include <sys/time.h>
#include <stdlib.h>
+#include <string.h>
#include "misc-private.h"
void _wapi_calc_timeout(struct timespec *timeout, guint32 ms)
{
struct timeval now;
#include "misc-private.h"
void _wapi_calc_timeout(struct timespec *timeout, guint32 ms)
{
struct timeval now;
- div_t divvy;
-
- divvy=div((int)ms, 1000);
- gettimeofday(&now, NULL);
+ div_t ms_divvy, overflow_divvy;
+
+ gettimeofday (&now, NULL);
+
+ ms_divvy = div (ms, 1000);
+ overflow_divvy = div ((now.tv_usec / 1000) + ms_divvy.rem, 1000);
- timeout->tv_sec
=now.tv_sec+
divvy.quot;
- timeout->tv_nsec
=(now.tv_usec+(divvy.rem*1000))*1
000;
+ timeout->tv_sec
= now.tv_sec + ms_divvy.quot + overflow_
divvy.quot;
+ timeout->tv_nsec
= overflow_divvy.rem * 1000
000;
}
}