2 * misc.c: Miscellaneous internal support functions
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002 Ximian, Inc.
15 #include "misc-private.h"
17 void _wapi_calc_timeout(struct timespec *timeout, guint32 ms)
22 gettimeofday(&now, NULL);
23 divvy=div((now.tv_usec/1000)+ms, 1000);
25 timeout->tv_sec=now.tv_sec+divvy.quot;
26 timeout->tv_nsec=divvy.rem*1000000;
29 /* This is used instead of g_renew when we need to keep unused
30 * elements NULL, because g_renew doesn't initialize the memory it
33 gpointer _wapi_g_renew0 (gpointer mem, gulong old_len, gulong new_len)
35 gpointer new_mem=g_malloc0 (new_len);
36 memcpy (new_mem, mem, old_len);