Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 #include "vrep_ros_plugin/porting.h"
00016 
00017 #ifdef _WIN32
00018 DWORD getTimeInMs(void)
00019 {
00020         return(timeGetTime()&0x03ffffff);
00021 }
00022 #endif 
00023 
00024 #if defined (__linux) || defined (__APPLE__)
00025 DWORD getTimeInMs(void)
00026 {
00027         struct timeval tv;
00028         DWORD result=0;
00029         if (gettimeofday(&tv,NULL)==0)
00030                 result=(tv.tv_sec*1000+tv.tv_usec/1000)&0x03ffffff;
00031         return(result);
00032 }
00033 #endif 
00034 
00035 DWORD getTimeDiffInMs(DWORD lastTime)
00036 {
00037         DWORD currentTime=getTimeInMs();
00038         if (currentTime<lastTime)
00039                 return(currentTime+0x03ffffff-lastTime);
00040         return(currentTime-lastTime);
00041 }