• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

gettimeofday.h

Go to the documentation of this file.
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 #else
00013 #include <sys/time.h>
00014 #include <unistd.h>
00015 
00016 // Uncomment this if you need to
00017 /*
00018 // http://www.halcode.com/archives/2008/08/26/retrieving-system-time-gettimeofday/
00019 struct timezone
00020 {
00021   int tz_minuteswest;
00022   int tz_dsttime;
00023 };
00024  
00025 #ifdef  __cplusplus
00026  
00027 void  GetSystemTimeAsFileTime(FILETIME*);
00028  
00029 inline int gettimeofday(struct timeval* p, void* tz )
00030 {
00031         union {
00032             long long ns100; // time since 1 Jan 1601 in 100ns units
00033                 FILETIME ft;
00034         } now;
00035  
00036     GetSystemTimeAsFileTime( &(now.ft) );
00037     p->tv_usec=(long)((now.ns100 / 10LL) % 1000000LL );
00038     p->tv_sec= (long)((now.ns100-(116444736000000000LL))/10000000LL);
00039         return 0;
00040 }
00041  
00042 #else
00043         int gettimeofday(struct timeval* p, void* tz );
00044 #endif
00045 */
00046 
00047 #endif
00048 
00049 #endif

Generated on Thu Sep 30 2010 01:27:24 for RakNet by  doxygen 1.7.1