Go to the documentation of this file.00001 #if defined(_XBOX) || defined(X360)
00002
00003 #endif
00004
00005 #if defined(_WIN32) && !defined(__GNUC__) &&!defined(__GCCXML__)
00006
00007 #include "gettimeofday.h"
00008
00009
00010
00011 #include "WindowsIncludes.h"
00012
00013 #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
00014 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
00015 #else
00016 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
00017 #endif
00018
00019 int gettimeofday(struct timeval *tv, struct timezone *tz)
00020 {
00021 FILETIME ft;
00022 unsigned __int64 tmpres = 0;
00023 static int tzflag;
00024
00025 if (NULL != tv)
00026 {
00027 GetSystemTimeAsFileTime(&ft);
00028
00029 tmpres |= ft.dwHighDateTime;
00030 tmpres <<= 32;
00031 tmpres |= ft.dwLowDateTime;
00032
00033
00034 tmpres /= 10;
00035 tmpres -= DELTA_EPOCH_IN_MICROSECS;
00036 tv->tv_sec = (long)(tmpres / 1000000UL);
00037 tv->tv_usec = (long)(tmpres % 1000000UL);
00038 }
00039
00040 if (NULL != tz)
00041 {
00042 if (!tzflag)
00043 {
00044 _tzset();
00045 tzflag++;
00046 }
00047 tz->tz_minuteswest = _timezone / 60;
00048 tz->tz_dsttime = _daylight;
00049 }
00050
00051 return 0;
00052 }
00053
00054 #endif
00055