utils.cc

00001 // utils.cpp : Defines the entry point for the DLL application.
00002 //
00003 
00004 #include "winsock2.h"
00005 
00006 #define EPOCHFILETIME (116444736000000000LL)
00007 
00008 int gettimeofday(struct timeval *tv, struct timezone *tz)
00009 {
00010     FILETIME        ft;
00011     LARGE_INTEGER   li;
00012     __int64         t;
00013     static int      tzflag;
00014 
00015     if (tv)
00016     {
00017         GetSystemTimeAsFileTime(&ft);
00018         li.LowPart  = ft.dwLowDateTime;
00019         li.HighPart = ft.dwHighDateTime;
00020         t  = li.QuadPart;       /* In 100-nanosecond intervals */
00021         t -= EPOCHFILETIME;     /* Offset to the Epoch time */
00022         t /= 10;                /* In microseconds */
00023         tv->tv_sec  = (long)(t / 1000000);
00024         tv->tv_usec = (long)(t % 1000000);
00025     }
00026 
00027 #if 0
00028     if (tz)
00029     {
00030         if (!tzflag)
00031         {
00032             _tzset();
00033             tzflag++;
00034         }
00035         tz->tz_minuteswest = _timezone / 60;
00036         tz->tz_dsttime = _daylight;
00037     }
00038 #endif
00039     return 0;
00040 }

Generated on Fri Oct 5 18:20:27 2007 for WvStreams by  doxygen 1.5.3