00001
00015 #ifndef _DLR_THREAD_PRIVATE_H_
00016 #define _DLR_THREAD_PRIVATE_H_
00017
00018 #include <dlrCommon/exception.h>
00019
00020 namespace dlr {
00021
00022 namespace thread {
00023
00024
00025
00026
00027 inline bool
00028 getXTime(double timeout, boost::xtime& xtimeout)
00029 {
00030 if(boost::xtime_get(&xtimeout, boost::TIME_UTC) == 0) {
00031
00032 return false;
00033 }
00034 long int seconds = static_cast<long int>(timeout);
00035 long int nanoSeconds = static_cast<long int>(
00036 (timeout - seconds) * 1000000000);
00037 xtimeout.sec += seconds;
00038 xtimeout.nsec += nanoSeconds;
00039 while(xtimeout.nsec >= 1000000000) {
00040 ++(xtimeout.sec);
00041 xtimeout.nsec -= 1000000000;
00042 }
00043 while(xtimeout.nsec < 0) {
00044 --(xtimeout.sec);
00045 xtimeout.nsec += 1000000000;
00046 }
00047 return true;
00048 }
00049
00050 }
00051
00052 }
00053
00054 #endif