![]() |
|
PhoenixClock
2.2.0
Library wrapping the usage of system's clock, allowing to use clock mock-ups
|
Nanosecond clock. More...
#include <PClockNs.h>
Public Types | |
| typedef std::chrono::nanoseconds | Nanosecond |
| typedef std::chrono::steady_clock | SteadyClock |
| typedef std::chrono::time_point< SteadyClock > | TimeNs |
Public Member Functions | |
| std::string | getDateCompactNs () const |
| Get the date at nanosecond precision (even if it is not precise at the nanosecond scale, it is normally coherent at this scale) | |
| std::string | getDateNs () const |
| Get the date at nanosecond precision (even if it is not precise at the nanosecond scale, it is normally coherent at this scale) | |
| std::time_t | getFullTimeNs () const |
| Get the full time in nanoseconds. | |
| std::time_t | getOffsetTimeNs () const |
| Get the offset in nanoseconds of the current clock. | |
| std::time_t | now () const |
| Get the full time in nanoseconds. | |
| PClockNs () | |
| Default constructor of PClockNs. | |
| void | setOffsetTimeNs (std::time_t offsetTimeNs) |
| Set the offset in nanoseconds of the current clock. | |
| void | sleep (EllapsedTime ellapsedTime) const |
| Sleep for the given ellapsed time. | |
| virtual | ~PClockNs () |
| Destructor of PClockNs. | |
Private Member Functions | |
| void | initialisationPClockNs () |
| Initialisation function of the class PClockNs. | |
Private Attributes | |
| TimeNs | p_baseSteadyClockNs |
| Base clock time with a nanosecond precision but since the starting of the CPU. | |
| std::time_t | p_baseSystemClockSecond |
| Base of the system clock in second. | |
| std::time_t | p_offsetTimeNs |
| Offset of time with date and nanoseconds. | |
Nanosecond clock.
Definition at line 18 of file PClockNs.h.
| typedef std::chrono::nanoseconds PClockNs::Nanosecond |
Definition at line 21 of file PClockNs.h.
| typedef std::chrono::steady_clock PClockNs::SteadyClock |
Definition at line 20 of file PClockNs.h.
| typedef std::chrono::time_point<SteadyClock> PClockNs::TimeNs |
Definition at line 22 of file PClockNs.h.
| PClockNs::PClockNs | ( | ) |
Default constructor of PClockNs.
Definition at line 43 of file PClockNs.cpp.
References initialisationPClockNs().
Here is the call graph for this function:
|
virtual |
| std::string PClockNs::getDateCompactNs | ( | ) | const |
Get the date at nanosecond precision (even if it is not precise at the nanosecond scale, it is normally coherent at this scale)
Definition at line 87 of file PClockNs.cpp.
References getFullTimeNs(), and phoenix_dateCompactNs().
Here is the call graph for this function:| std::string PClockNs::getDateNs | ( | ) | const |
Get the date at nanosecond precision (even if it is not precise at the nanosecond scale, it is normally coherent at this scale)
Definition at line 80 of file PClockNs.cpp.
References getFullTimeNs(), and phoenix_dateNs().
Here is the call graph for this function:| std::time_t PClockNs::getFullTimeNs | ( | ) | const |
Get the full time in nanoseconds.
Definition at line 69 of file PClockNs.cpp.
References p_baseSteadyClockNs, p_baseSystemClockSecond, and p_offsetTimeNs.
Referenced by getDateCompactNs(), getDateNs(), and now().
Here is the caller graph for this function:| std::time_t PClockNs::getOffsetTimeNs | ( | ) | const |
Get the offset in nanoseconds of the current clock.
Definition at line 62 of file PClockNs.cpp.
References p_offsetTimeNs.
|
private |
Initialisation function of the class PClockNs.
Definition at line 106 of file PClockNs.cpp.
References p_baseSteadyClockNs, p_baseSystemClockSecond, and p_offsetTimeNs.
Referenced by PClockNs().
Here is the caller graph for this function:| std::time_t PClockNs::now | ( | ) | const |
Get the full time in nanoseconds.
Definition at line 94 of file PClockNs.cpp.
References getFullTimeNs().
Here is the call graph for this function:| void PClockNs::setOffsetTimeNs | ( | std::time_t | offsetTimeNs | ) |
Set the offset in nanoseconds of the current clock.
| offsetTimeNs | : offset in nanoseconds of the current clock |
Definition at line 55 of file PClockNs.cpp.
References p_offsetTimeNs.
| void PClockNs::sleep | ( | EllapsedTime | ellapsedTime | ) | const |
Sleep for the given ellapsed time.
| ellapsedTime | : time to sleep in nanoseconds |
Definition at line 101 of file PClockNs.cpp.
|
private |
Base clock time with a nanosecond precision but since the starting of the CPU.
Definition at line 41 of file PClockNs.h.
Referenced by getFullTimeNs(), and initialisationPClockNs().
|
private |
Base of the system clock in second.
Definition at line 39 of file PClockNs.h.
Referenced by getFullTimeNs(), and initialisationPClockNs().
|
private |
Offset of time with date and nanoseconds.
Definition at line 43 of file PClockNs.h.
Referenced by getFullTimeNs(), getOffsetTimeNs(), initialisationPClockNs(), and setOffsetTimeNs().