All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
milliSeconds.cc
Go to the documentation of this file.
1 /* real_time.cc
2  */
4 #ifdef _WIN32
5 # include <sys/timeb.h>
6 #else
7 # include <sys/time.h>
8 #endif
10 {
11 #ifdef _WIN32
12  struct _timeb now;
13  _ftime(&now); // mingw does not support _ftime_s
14  return MilliSeconds((int64_t)now.time*1000 + now.millitm);
15 #else
16  timeval now;
17  gettimeofday(&now, 0);
18  return MilliSeconds((int64_t)now.tv_sec*1000 + now.tv_usec/1000);
19 #endif
20 }
21 
22 /* ------------------------------------------------------------------------- */
23 // ;;; Local Variables:
24 // ;;; mode:c++
25 // ;;; c-basic-offset:2
26 // ;;; End: