TimeService.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002  tag: Peter Soetens  Wed Apr 17 16:01:36 CEST 2002  TimeService.h
00003 
00004                        TimeService.h -  description
00005                           -------------------
00006    begin                : Wed April 17 2002
00007    copyright            : (C) 2002 Peter Soetens
00008    email                : peter.soetens@mech.kuleuven.ac.be
00009 
00010 ***************************************************************************
00011 *                                                                         *
00012 *   This program is free software; you can redistribute it and/or modify  *
00013 *   it under the terms of the GNU General Public License as published by  *
00014 *   the Free Software Foundation; either version 2 of the License, or     *
00015 *   (at your option) any later version.                                   *
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 
00163         ticks ticksChange( ticks delta );
00164 
00170         void enableSystemClock( bool yes_no );
00171 
00176         bool systemClockEnabled() const;
00177 
00183         nsecs getNSecs() const;
00184 
00191         nsecs getNSecs( nsecs &relativeTime ) const;
00192 
00198         static ticks nsecs2ticks( const nsecs m );
00199 
00203         static nsecs ticks2nsecs( const ticks t );
00204 
00208         static const ticks InfiniteTicks;
00209 
00213         static const nsecs InfiniteNSecs;
00214 
00218         static const Seconds InfiniteSeconds;
00219     protected:
00220 
00224         TimeService();
00225 
00226     private:
00227 
00231         static TimeService* _instance;
00232 
00236         ticks offset;
00237 
00238         bool use_clock;
00239     };
00240 }} // namespace RTT
00241 
00242 #endif


rtt
Author(s): RTT Developers
autogenerated on Wed Aug 26 2015 16:16:19