00001 /*************************************************************************** 00002 LOW_platformMisc.cpp - description 00003 ------------------- 00004 begin : Thu Aug 1 2002 00005 copyright : (C) 2002 by Harald Roelle 00006 email : roelle@informatik.uni-muenchen.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 00019 #include "LOW_platformMisc.h" 00020 00021 00022 const LOW_platformMisc* LOW_platformMisc::runtimeInstance = LOW_platformMiscFactory::new_platformMisc(); 00023 00024 00025 const void LOW_platformMisc::secSleep( const unsigned int inSeconds) 00026 { 00027 runtimeInstance->p_secSleep( inSeconds); 00028 } 00029 00030 00031 const void LOW_platformMisc::milliSleep( const unsigned long inMilliSeconds) 00032 { 00033 runtimeInstance->p_milliSleep( inMilliSeconds); 00034 } 00035 00036 00037 const void LOW_platformMisc::microSleep( const unsigned long inMicroSeconds) 00038 { 00039 runtimeInstance->p_microSleep( inMicroSeconds); 00040 } 00041 00042 00043 const void LOW_platformMisc::nanoSleep( const unsigned long inNanoSeconds) 00044 { 00045 runtimeInstance->p_nanoSleep( inNanoSeconds); 00046 } 00047 00048 00049 const void LOW_platformMisc::nanoSleep( const unsigned int inSeconds, const unsigned long inNanoSeconds) 00050 { 00051 runtimeInstance->p_nanoSleep( inSeconds, inNanoSeconds); 00052 } 00053 00054 00055 const void LOW_platformMisc::getTimestamp( timestamp_t &outTimestamp) 00056 { 00057 runtimeInstance->p_getTimestamp( outTimestamp); 00058 } 00059 00060 00061 const void LOW_platformMisc::diffTimestamp( const timestamp_t &inT1, const timestamp_t &inT2, timestamp_t &outResult) 00062 { 00063 outResult.sec = inT1.sec - inT2.sec; 00064 outResult.milSec = inT1.milSec - inT2.milSec; 00065 00066 if ( outResult.sec<0 && outResult.milSec>0 ) { 00067 outResult.sec++; 00068 outResult.milSec = 1000-outResult.milSec; 00069 } 00070 else if ( outResult.sec>0 && outResult.milSec<0 ) { 00071 outResult.sec--; 00072 outResult.milSec += 1000; 00073 } 00074 } 00075 00076 00077 const LOW_platformMiscFactory::threadIdent_t LOW_platformMisc::getThreadID() 00078 { 00079 return runtimeInstance->p_getThreadID(); 00080 } 00081 00082 00083 const std::string LOW_platformMisc::getHostname() 00084 { 00085 return runtimeInstance->p_getHostname(); 00086 } 00087 00088