![]() |
appkit
1.5.1
RoadNarrows Robotics Application Kit
|
#include <Time.h>
Public Member Functions | |
| Time () | |
| Default constructor. | |
| Time (const timespec &ts) | |
| Initialization constructor. More... | |
| Time (const double &t) | |
| Initialization constructor. More... | |
| Time (const Time &src) | |
| Copy constructor. More... | |
| ~Time () | |
| Destructor. | |
| double | t () |
| Get this object's value as a floating point number of seconds and fractions of a second. More... | |
| timespec | ts () |
| Get this object's value in timespec format. More... | |
| bool | isSet () |
| Check if this object's time is set. More... | |
| void | clear () |
| Clear this object's time. | |
| double | getResolution () |
| Get the CLOCK_REALTIME resolution. More... | |
| double | now () |
| Get the current time, indentified by CLOCK_REALTIME, since the last Epoch. More... | |
| double | markNow () |
| Mark the current time, indentified by CLOCK_REALTIME, since the last Epoch. More... | |
| Time & | operator= (const Time &b) |
| this = b More... | |
| Time & | operator= (const timespec &b) |
| this = b More... | |
| Time & | operator= (const double &b) |
| this = b More... | |
| Time & | operator+= (const Time &b) |
| this += b More... | |
| Time & | operator+= (const timespec &b) |
| this += b More... | |
| Time & | operator+= (const double &b) |
| this += b More... | |
| Time & | operator-= (const Time &b) |
| this -= b More... | |
| Time & | operator-= (const timespec &b) |
| this -= b More... | |
| Time & | operator-= (const double &b) |
| this -= b More... | |
| Time & | operator*= (const double &b) |
| this *= b More... | |
| bool | operator== (const Time &b) |
| this == b More... | |
| bool | operator== (const timespec &b) |
| this == b More... | |
| bool | operator== (const double &b) |
| this == b More... | |
| bool | operator< (const Time &b) |
| this < b More... | |
| bool | operator< (const timespec &b) |
| this < b More... | |
| bool | operator< (const double &b) |
| this < b More... | |
| bool | operator> (const Time &b) |
| this > b More... | |
| bool | operator> (const timespec &b) |
| this > b More... | |
| bool | operator> (const double &b) |
| this > b More... | |
| bool | operator<= (const Time &b) |
| this <= b More... | |
| bool | operator<= (const timespec &b) |
| this <= b More... | |
| bool | operator<= (const double &b) |
| this <= b More... | |
| bool | operator>= (const Time &b) |
| this >= b More... | |
| bool | operator>= (const timespec &b) |
| this >= b More... | |
| bool | operator>= (const double &b) |
| this >= b More... | |
| std::string | calendarTime (const int resSec=0) const |
Protected Attributes | |
| timespec | m_tsTime |
| time in timespec format | |
| double | m_fpTime |
| time in floating point format | |
Friends | |
| Time | operator+ (Time a, const Time &b) |
| c = a + b More... | |
| Time | operator+ (Time a, const timespec &b) |
| c = a + b More... | |
| Time | operator+ (Time a, const double &b) |
| c = a + b More... | |
| Time | operator- (Time a, const Time &b) |
| c = a - b More... | |
| Time | operator- (Time a, const timespec &b) |
| c = a - b More... | |
| Time | operator- (Time a, const double &b) |
| c = a - b More... | |
| Time | operator* (Time a, const double &b) |
| c = a * b More... | |
| std::ostream & | operator<< (std::ostream &os, const Time &obj) |
| Time insertion operator. More... | |
Time class.
The class uses timespec as the underlining interface to system calls. Some calls require the lower resolution timeval interface. This class will autobmaitcally down/up samples between the two interfaces
| Time::Time | ( | const timespec & | ts | ) |
Initialization constructor.
| ts | Time in timespec format. |
Definition at line 167 of file Time.cxx.
References rnr::chronos::toFp().
| Time::Time | ( | const double & | t | ) |
Initialization constructor.
| t | Seconds. |
Definition at line 173 of file Time.cxx.
References rnr::chronos::toTs().
| Time::Time | ( | const Time & | src | ) |
| double Time::getResolution | ( | ) |
Get the CLOCK_REALTIME resolution.
Definition at line 196 of file Time.cxx.
References rnr::chronos::clear(), and rnr::chronos::toFp().
Referenced by isSet().
|
inline |
Check if this object's time is set.
Definition at line 254 of file Time.h.
References clear(), getResolution(), rnr::chronos::isSet(), m_tsTime, markNow(), now(), operator*=(), operator+=(), operator-=(), and operator=().
| double Time::markNow | ( | ) |
Mark the current time, indentified by CLOCK_REALTIME, since the last Epoch.
The internal time data are automatically updated.
Definition at line 215 of file Time.cxx.
References rnr::chronos::now(), and rnr::chronos::toFp().
Referenced by isSet(), rnr::Thread::schedBlock(), and rnr::Thread::thread().
| double Time::now | ( | ) |
Get the current time, indentified by CLOCK_REALTIME, since the last Epoch.
No internal time data are touched.
Definition at line 208 of file Time.cxx.
References rnr::chronos::now(), and rnr::chronos::toFp().
Referenced by execFeedAnimal(), execSleep(), execWalkAnimal(), isSet(), and updateAnimals().
| Time & Time::operator*= | ( | const double & | b | ) |
this *= b
| b | Rvalue object. |
Definition at line 290 of file Time.cxx.
References rnr::chronos::toTs().
Referenced by isSet().
this += b
| b | Rvalue object. |
Definition at line 248 of file Time.cxx.
References rnr::chronos::add(), m_tsTime, and rnr::chronos::toFp().
Referenced by isSet().
| Time & Time::operator+= | ( | const timespec & | b | ) |
this += b
| b | Rvalue object. |
Definition at line 255 of file Time.cxx.
References rnr::chronos::add(), and rnr::chronos::toFp().
| Time & Time::operator+= | ( | const double & | b | ) |
this += b
| b | Rvalue object. |
Definition at line 262 of file Time.cxx.
References rnr::chronos::toTs().
this -= b
| b | Rvalue object. |
Definition at line 269 of file Time.cxx.
References m_tsTime, rnr::chronos::sub(), and rnr::chronos::toFp().
Referenced by isSet().
| Time & Time::operator-= | ( | const timespec & | b | ) |
this -= b
| b | Rvalue object. |
Definition at line 276 of file Time.cxx.
References rnr::chronos::sub(), and rnr::chronos::toFp().
| Time & Time::operator-= | ( | const double & | b | ) |
this -= b
| b | Rvalue object. |
Definition at line 283 of file Time.cxx.
References rnr::chronos::toTs().
|
inline |
this < b
| b | Rvalue object. |
Definition at line 495 of file Time.h.
References m_tsTime.
Referenced by operator<=().
| bool Time::operator< | ( | const timespec & | b | ) |
|
inline |
|
inline |
this <= b
| b | Rvalue object. |
Definition at line 549 of file Time.h.
References m_tsTime, operator<(), and operator==().
|
inline |
this <= b
| b | Rvalue object. |
Definition at line 555 of file Time.h.
References operator<(), and operator==().
|
inline |
| Time & Time::operator= | ( | const timespec & | b | ) |
this = b
| b | Rvalue object. |
Definition at line 234 of file Time.cxx.
References rnr::chronos::toFp().
| Time & Time::operator= | ( | const double & | b | ) |
this = b
| b | Rvalue object. |
Definition at line 241 of file Time.cxx.
References rnr::chronos::toTs().
|
inline |
this == b
| b | Rvalue object. |
Definition at line 464 of file Time.h.
References m_tsTime.
Referenced by operator<=(), and operator>=().
|
inline |
|
inline |
|
inline |
this > b
| b | Rvalue object. |
Definition at line 522 of file Time.h.
References m_tsTime.
Referenced by operator>=().
| bool Time::operator> | ( | const timespec & | b | ) |
this > b
| b | Rvalue object. |
Definition at line 323 of file Time.cxx.
References m_tsTime, rnr::chronos::operator<<(), and rnr::str::rtrim().
|
inline |
|
inline |
this >= b
| b | Rvalue object. |
Definition at line 579 of file Time.h.
References m_tsTime, operator==(), and operator>().
|
inline |
this >= b
| b | Rvalue object. |
Definition at line 585 of file Time.h.
References operator==(), and operator>().
|
inline |
this >= b
| b | Rvalue object. |
Definition at line 591 of file Time.h.
References m_fpTime, and operator<<.
|
inline |
|
inline |
Get this object's value in timespec format.
Definition at line 244 of file Time.h.
References m_tsTime.
Referenced by rnr::Thread::exec(), and rnr::Thread::schedBlock().
|
friend |
Time insertion operator.
| os | Output stream. |
| obj | Object to insert. |
Referenced by operator>=().