# HG changeset patch # User Herman Bloggs # Date 1035225144 0 # Node ID 10ffafd1c91fb8a9466c07e2cc6b122c5244df33 # Parent 21d296405cfdfa817a31bef597af5e8682c93743 [gaim-migrate @ 3917] gettimeofday added committer: Tailor Script diff -r 21d296405cfd -r 10ffafd1c91f src/win32/libc_interface.c --- a/src/win32/libc_interface.c Mon Oct 21 18:30:59 2002 +0000 +++ b/src/win32/libc_interface.c Mon Oct 21 18:32:24 2002 +0000 @@ -6,11 +6,29 @@ * Description: Commonly used libc routines. */ #include +#include #include +#include #include +#include +#include +#include "libc_internal.h" + +/* + * PROTOS + */ +extern void debug_printf(char * fmt, ...); + +/* + * LOCALS + */ static char errbuf[1024]; +/* + * CODE + */ + /* helpers */ static int wgaim_is_socket( int fd ) { int optval; @@ -69,8 +87,6 @@ /* fcntl.h */ /* This is not a full implementation of fcntl. Update as needed.. */ -#define O_NONBLOCK 1 -#define F_SETFL 1 int wgaim_fcntl(int socket, int command, int val) { switch( command ) { case F_SETFL: @@ -213,3 +229,24 @@ else return close(fd); } + +/* sys/time.h */ + +int wgaim_gettimeofday(struct timeval *p, struct timezone *z) { + int res = 0; + struct _timeb timebuffer; + + if (z != 0) { + _tzset(); + z->tz_minuteswest = _timezone/60; + z->tz_dsttime = _daylight; + } + + if (p != 0) { + _ftime(&timebuffer); + p->tv_sec = timebuffer.time; /* seconds since 1-1-1970 */ + p->tv_usec = timebuffer.millitm*1000; /* microseconds */ + } + + return res; +}