![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 #ifndef __GET_TIME_OF_DAY_H 00002 #define __GET_TIME_OF_DAY_H 00003 00004 #if defined(_WIN32) && !defined(__GNUC__) &&!defined(__GCCXML__) 00005 #include < time.h > 00006 struct timezone 00007 { 00008 int tz_minuteswest; /* minutes W of Greenwich */ 00009 int tz_dsttime; /* type of dst correction */ 00010 }; 00011 int gettimeofday(struct timeval *tv, struct timezone *tz); 00012 00013 00014 #else 00015 00016 00017 00018 00019 #include <sys/time.h> 00020 00021 #include <unistd.h> 00022 00023 // Uncomment this if you need to 00024 /* 00025 // http://www.halcode.com/archives/2008/08/26/retrieving-system-time-gettimeofday/ 00026 struct timezone 00027 { 00028 int tz_minuteswest; 00029 int tz_dsttime; 00030 }; 00031 00032 #ifdef __cplusplus 00033 00034 void GetSystemTimeAsFileTime(FILETIME*); 00035 00036 inline int gettimeofday(struct timeval* p, void* tz ) 00037 { 00038 union { 00039 long long ns100; // time since 1 Jan 1601 in 100ns units 00040 FILETIME ft; 00041 } now; 00042 00043 GetSystemTimeAsFileTime( &(now.ft) ); 00044 p->tv_usec=(long)((now.ns100 / 10LL) % 1000000LL ); 00045 p->tv_sec= (long)((now.ns100-(116444736000000000LL))/10000000LL); 00046 return 0; 00047 } 00048 00049 #else 00050 int gettimeofday(struct timeval* p, void* tz ); 00051 #endif 00052 */ 00053 00054 #endif 00055 00056 #endif
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.