Mercurial > pidgin
changeset 3777:10ffafd1c91f
[gaim-migrate @ 3917]
gettimeofday added
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Mon, 21 Oct 2002 18:32:24 +0000 |
parents | 21d296405cfd |
children | 813304a57f88 |
files | src/win32/libc_interface.c |
diffstat | 1 files changed, 39 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 <winsock.h> +#include <io.h> #include <stdlib.h> +#include <stdio.h> #include <errno.h> +#include <sys/timeb.h> +#include <time.h> +#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; +}