Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef RTT_TIME_SERVICE_HPP
00022 #define RTT_TIME_SERVICE_HPP
00023
00024 #include "Time.hpp"
00025 #include "../rtt-config.h"
00026
00027 namespace RTT
00028 { namespace os {
00029
00030
00035 class RTT_API TimeService
00036 {
00037 public:
00041 typedef double Seconds;
00042
00046 typedef long secs;
00047
00051 typedef long msecs;
00052
00056 typedef long usecs;
00057
00061 typedef long long nsecs;
00062
00066 typedef long long ticks;
00067
00068 public:
00069 static TimeService* Instance();
00070
00077 static bool Release();
00078
00082 virtual ~TimeService();
00083
00090 ticks ticksGet() const { return getTicks(); }
00091
00097 ticks getTicks() const;
00098
00106 ticks ticksGet( ticks &relativeTime ) const { return getTicks( relativeTime ); }
00107
00114 ticks getTicks( ticks &relativeTime ) const;
00115
00122 ticks ticksSince( ticks relativeTime ) const;
00123
00133 Seconds secondsGet( ticks &relativeTime ) const { return getSeconds(relativeTime); }
00134
00143 Seconds getSeconds( ticks &relativeTime ) const;
00144
00151 Seconds secondsSince( ticks relativeTime ) const;
00152
00157 Seconds secondsChange( Seconds delta );
00158
00164 void enableSystemClock( bool yes_no );
00165
00171 nsecs getNSecs() const;
00172
00179 nsecs getNSecs( nsecs &relativeTime ) const;
00180
00186 static ticks nsecs2ticks( const nsecs m );
00187
00191 static nsecs ticks2nsecs( const ticks t );
00192
00196 static const ticks InfiniteTicks;
00197
00201 static const nsecs InfiniteNSecs;
00202
00206 static const Seconds InfiniteSeconds;
00207 protected:
00208
00212 TimeService();
00213
00214 private:
00215
00219 static TimeService* _instance;
00220
00224 ticks offset;
00225
00226 bool use_clock;
00227 };
00228 }}
00229
00230 #endif