milliSeconds.cc
Go to the documentation of this file.
00001 /* real_time.cc
00002  */
00003 #include "osl/misc/milliSeconds.h"
00004 #ifdef _WIN32
00005 #  include <sys/timeb.h>
00006 #else
00007 #  include <sys/time.h>
00008 #endif
00009 const osl::misc::MilliSeconds osl::misc::MilliSeconds::now()
00010 {
00011 #ifdef _WIN32
00012   struct _timeb now;
00013   _ftime(&now); // mingw does not support _ftime_s
00014   return MilliSeconds((int64_t)now.time*1000 + now.millitm);
00015 #else
00016   timeval now;
00017   gettimeofday(&now, 0);
00018   return MilliSeconds((int64_t)now.tv_sec*1000 + now.tv_usec/1000);
00019 #endif
00020 }
00021 
00022 /* ------------------------------------------------------------------------- */
00023 // ;;; Local Variables:
00024 // ;;; mode:c++
00025 // ;;; c-basic-offset:2
00026 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines