A fixed-width timespec structure. More...
#include <timespecX.hpp>
Public Member Functions | |
timespecX () | |
Default c'tor. More... | |
timespecX (secT s, nanosecT ns) | |
Construct with time values. More... | |
timespecX (const timespec &ts) | |
Construct from timespec. More... | |
timespecX & | operator= (const timespec &ts) |
Convert a native timespec to a timespecX. More... | |
timespec | getTimespec () |
Get a native timespec from this custom one. More... | |
template<clockid_t clk_id = CLOCK_REALTIME> | |
void | gettime () |
Fill the the timespecX with the current time. More... | |
int | timeStamp (std::string &tstamp) |
Get the filename timestamp for this timespecX. More... | |
std::string | timeStamp () |
Get the filname timestamp for this timespecX. More... | |
std::string | ISO8601DateTimeStrX () |
Get a date-time string in ISO 8601 format for timespecX. More... | |
std::string | ISO8601DateTimeStr2MinX () |
std::string | secondStrX () |
Get a date-time string with just the second for timespecX. More... | |
int | minute () |
Get the minute from a timespecX. More... | |
double | asDouble () |
Get the time as a double from a timespecX. More... | |
Public Attributes | |
secT | time_s {0} |
Time since the Unix epoch. More... | |
nanosecT | time_ns {0} |
Nanoseconds. More... | |
A fixed-width timespec structure.
To ensure that binary encoding of time is stable regardless of environment, we use a custom timespec composed of fixed-width types.
Definition at line 34 of file timespecX.hpp.
|
inline |
Default c'tor.
Definition at line 40 of file timespecX.hpp.
Construct with time values.
Definition at line 45 of file timespecX.hpp.
|
inline |
Construct from timespec.
Definition at line 50 of file timespecX.hpp.
|
inline |
Get the time as a double from a timespecX.
Definition at line 231 of file timespecX.hpp.
Referenced by MagAOX::logger::getLogContVal().
|
inline |
Fill the the timespecX with the current time.
This is based on the usual clock_gettime. clockid_t is a template parameter since we probaby always want CLOCK_REALTIME, but if we don't for some reason it will be passed in the same order as in clock_gettime.
clk_id | specifies the type. |
Definition at line 94 of file timespecX.hpp.
Referenced by flatlogs::clock_gettimeX(), and MagAOX::logger::logManager< _parentT, _logFileT >::createLog().
|
inline |
Get a native timespec from this custom one.
Definition at line 76 of file timespecX.hpp.
|
inline |
Definition at line 170 of file timespecX.hpp.
|
inline |
Get a date-time string in ISO 8601 format for timespecX.
Returns a string in the ISO 8601 format:
YYYY-MM-DDTHH:MM:SS.SSSSSSSSS
std::string | containing the formated date/time |
Definition at line 153 of file timespecX.hpp.
Referenced by logdump::gettimes(), flatlogs::jsonFormat(), and flatlogs::stdFormat().
|
inline |
Get the minute from a timespecX.
Definition at line 216 of file timespecX.hpp.
|
inline |
Convert a native timespec to a timespecX.
[in] | ts | the native timespec from which to get values |
Definition at line 59 of file timespecX.hpp.
Referenced by timespecX().
|
inline |
Get a date-time string with just the second for timespecX.
Returns a string in the format:
SS.SSS
which is useful for real-time streams of log entries.
std::string | containing the formated date/time |
Definition at line 193 of file timespecX.hpp.
Referenced by flatlogs::stdShortFormat().
|
inline |
Get the filname timestamp for this timespecX.
Returns a string with the timestamp encoded as
YYYYMMDDHHMMSSNNNNNNNNN
Definition at line 136 of file timespecX.hpp.
|
inline |
Get the filename timestamp for this timespecX.
Fills in a string with the timestamp encoded as
YYYYMMDDHHMMSSNNNNNNNNN
[out] | tstamp | the string to hold the formatted time |
Definition at line 108 of file timespecX.hpp.
Referenced by MagAOX::logger::logFileRaw::createFile().
nanosecT flatlogs::timespecX::time_ns {0} |
Nanoseconds.
Definition at line 37 of file timespecX.hpp.
Referenced by asDouble(), logdump::gettimes(), getTimespec(), ISO8601DateTimeStrX(), MagAOX::logger::logInMemory::loadFile(), MagAOX::app::MagAOXApp< _useINDI >::logMessage(), flatlogs::meanTimespecX(), flatlogs::operator<(), operator=(), flatlogs::operator==(), flatlogs::operator>(), MagAOX::logger::logFileName::parseName(), MagAOX::app::xindiserver::processISLog(), secondStrX(), flatlogs::timespecFromX(), and timeStamp().
secT flatlogs::timespecX::time_s {0} |
Time since the Unix epoch.
Definition at line 36 of file timespecX.hpp.
Referenced by asDouble(), MagAOX::logger::logMap::getPriorLog(), logdump::gettimes(), getTimespec(), ISO8601DateTimeStr2MinX(), ISO8601DateTimeStrX(), MagAOX::logger::logInMemory::loadFile(), MagAOX::app::MagAOXApp< _useINDI >::logMessage(), flatlogs::meanTimespecX(), minute(), flatlogs::operator<(), operator=(), flatlogs::operator==(), flatlogs::operator>(), MagAOX::logger::logFileName::parseName(), MagAOX::app::xindiserver::processISLog(), secondStrX(), flatlogs::timespecFromX(), and timeStamp().