[boehm] Put *_freelists into thread_local_freelists (as in BDWGC v7)
[mono.git] / mono / io-layer / misc.c
1 /*
2  * misc.c:  Miscellaneous internal support functions
3  *
4  * Author:
5  *      Dick Porter (dick@ximian.com)
6  *
7  * (C) 2002 Ximian, Inc.
8  */
9
10 #include <config.h>
11 #include <glib.h>
12 #include <sys/time.h>
13 #include <stdlib.h>
14 #include <string.h>
15
16 #include "misc-private.h"
17
18 void _wapi_calc_timeout(struct timespec *timeout, guint32 ms)
19 {
20         struct timeval now;
21         div_t ms_divvy, overflow_divvy;
22         
23         gettimeofday (&now, NULL);
24
25         ms_divvy = div (ms, 1000);
26         overflow_divvy = div ((now.tv_usec / 1000) + ms_divvy.rem, 1000);
27                 
28         timeout->tv_sec = now.tv_sec + ms_divvy.quot + overflow_divvy.quot;
29         timeout->tv_nsec = overflow_divvy.rem * 1000000;
30 }