16 std::time_t currentTimeSecond = currentDateNs / 1000000000l;
17 std::tm* now_tm = std::gmtime(¤tTimeSecond);
19 std::strftime(buf, 42,
"%Y/%m/%d : %X", now_tm);
20 std::time_t timeNanoSecond = currentDateNs - currentTimeSecond*1000000000l;
21 std::stringstream dateNs;
22 dateNs << buf <<
"." << std::setfill(
'0') << std::setw(9) << timeNanoSecond;
71 std::time_t ellapsedTimeNsSinceStart = (PClockNs::SteadyClock::now() -
p_baseSteadyClockNs).count();
102 std::this_thread::sleep_for(std::chrono::nanoseconds(ellapsedTime));
std::string phoenix_dateNs(std::time_t currentDateNs, const char *format)
Convert a given date in nanosecond into a text date.
std::string phoenix_dateCompactNs(std::time_t currentDateNs)
Convert a given date in nanosecond into a text date in a more compact way.
std::string phoenix_dateNs(std::time_t currentDateNs, const char *format)
Convert a given date in nanosecond into a text date.
std::string phoenix_dateCompactNs(std::time_t currentDateNs)
Convert a given date in nanosecond into a text date in a more compact way.
std::string getDateCompactNs() const
Get the date at nanosecond precision (even if it is not precise at the nanosecond scale,...
std::time_t now() const
Get the full time in nanoseconds.
void initialisationPClockNs()
Initialisation function of the class PClockNs.
void sleep(EllapsedTime ellapsedTime) const
Sleep for the given ellapsed time.
std::time_t getOffsetTimeNs() const
Get the offset in nanoseconds of the current clock.
std::time_t getFullTimeNs() const
Get the full time in nanoseconds.
virtual ~PClockNs()
Destructor of PClockNs.
void setOffsetTimeNs(std::time_t offsetTimeNs)
Set the offset in nanoseconds of the current clock.
std::string getDateNs() const
Get the date at nanosecond precision (even if it is not precise at the nanosecond scale,...
PClockNs()
Default constructor of PClockNs.
std::time_t p_baseSystemClockSecond
Base of the system clock in second.
std::time_t p_offsetTimeNs
Offset of time with date and nanoseconds.
TimeNs p_baseSteadyClockNs
Base clock time with a nanosecond precision but since the starting of the CPU.