GNU Radio 3.6.0 C++ API
|
00001 #ifndef _MSC_VER // [ 00002 #error "Use this header only with Microsoft Visual C++ compilers!" 00003 #endif // _MSC_VER ] 00004 00005 #ifndef _MSC_SYS_TIME_H_ 00006 #define _MSC_SYS_TIME_H_ 00007 00008 //http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/430449b3-f6dd-4e18-84de-eebd26a8d668 00009 #include < time.h > 00010 #include <windows.h> //I've ommited this line. 00011 #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) 00012 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 00013 #else 00014 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL 00015 #endif 00016 00017 struct timespec { 00018 00019 time_t tv_sec; /* Seconds since 00:00:00 GMT, */ 00020 00021 /* 1 January 1970 */ 00022 00023 long tv_nsec; /* Additional nanoseconds since */ 00024 00025 /* tv_sec */ 00026 00027 }; 00028 00029 struct timezone 00030 { 00031 int tz_minuteswest; /* minutes W of Greenwich */ 00032 int tz_dsttime; /* type of dst correction */ 00033 }; 00034 00035 static inline int gettimeofday(struct timeval *tv, struct timezone *tz) 00036 { 00037 FILETIME ft; 00038 unsigned __int64 tmpres = 0; 00039 static int tzflag; 00040 00041 if (NULL != tv) 00042 { 00043 GetSystemTimeAsFileTime(&ft); 00044 00045 tmpres |= ft.dwHighDateTime; 00046 tmpres <<= 32; 00047 tmpres |= ft.dwLowDateTime; 00048 00049 /*converting file time to unix epoch*/ 00050 tmpres -= DELTA_EPOCH_IN_MICROSECS; 00051 tv->tv_sec = (long)(tmpres / 1000000UL); 00052 tv->tv_usec = (long)(tmpres % 1000000UL); 00053 } 00054 00055 if (NULL != tz) 00056 { 00057 if (!tzflag) 00058 { 00059 _tzset(); 00060 tzflag++; 00061 } 00062 tz->tz_minuteswest = _timezone / 60; 00063 tz->tz_dsttime = _daylight; 00064 } 00065 00066 return 0; 00067 } 00068 00069 #endif //_MSC_SYS_TIME_H_