porting.cpp
Go to the documentation of this file.
00001 // Copyright 2006-2013 Dr. Marc Andreas Freese. All rights reserved. 
00002 // marc@coppeliarobotics.com
00003 // www.coppeliarobotics.com
00004 // 
00005 // -------------------------------------------------------------------
00006 // This file is distributed in the hope that it will be useful,
00007 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00008 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00009 // 
00010 // You are free to use/modify/distribute this file for whatever purpose!
00011 // -------------------------------------------------------------------
00012 //
00013 // This file was automatically created for V-REP release V3.0.5 on October 26th 2013
00014 
00015 #include "vrep_ros_plugin/porting.h"
00016 
00017 #ifdef _WIN32
00018 DWORD getTimeInMs(void)
00019 {
00020         return(timeGetTime()&0x03ffffff);
00021 }
00022 #endif /* _WIN32 */
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 /* __linux || __APPLE__ */
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 }


vrep_ros_plugin
Author(s): Riccardo Spica , Giovanni Claudio
autogenerated on Sat Jun 8 2019 20:22:41