artdaq_core
v3_01_05
|
Namespace to hold useful time-converting functions. More...
Typedefs | |
typedef std::chrono::duration < double, std::ratio< 1 > > | seconds |
Functions | |
constexpr double | GetElapsedTime (std::chrono::steady_clock::time_point then, std::chrono::steady_clock::time_point now=std::chrono::steady_clock::now()) |
Get the number of seconds in the given interval More... | |
constexpr size_t | GetElapsedTimeMicroseconds (std::chrono::steady_clock::time_point then, std::chrono::steady_clock::time_point now=std::chrono::steady_clock::now()) |
Gets the number of microseconds in the given time interval More... | |
constexpr size_t | GetElapsedTimeMilliseconds (std::chrono::steady_clock::time_point then, std::chrono::steady_clock::time_point now=std::chrono::steady_clock::now()) |
Gets the number of milliseconds in the given time interval More... | |
std::string | convertUnixTimeToString (time_t inputUnixTime) |
Converts a Unix time to its string representation, in UTC. More... | |
std::string | convertUnixTimeToString (struct timeval const &inputUnixTime) |
Converts a Unix time to its string representation, in UTC. More... | |
std::string | convertUnixTimeToString (struct timespec const &inputUnixTime) |
Converts a Unix time to its string representation, in UTC. More... | |
uint64_t | gettimeofday_us () |
Get the current time of day in microseconds (from gettimeofday system call) More... | |
double | convertUnixTimeToSeconds (time_t inputUnixTime) |
Converts a Unix time to double. More... | |
double | convertUnixTimeToSeconds (struct timeval const &inputUnixTime) |
Converts a Unix time to double. More... | |
double | convertUnixTimeToSeconds (struct timespec const &inputUnixTime) |
Converts a Unix time to double. More... | |
Namespace to hold useful time-converting functions.
typedef std::chrono::duration<double, std::ratio<1> > artdaq::TimeUtils::seconds |
We shall use artdaq::detail::seconds as our "standard" duration type. Note that this differs from std::chrono::seconds, which has a representation in some integer type of at least 35 bits.
daqrate::duration dur(1.0) represents a duration of 1 second. daqrate::duration dur2(0.001) represents a duration of 1 millisecond.
Definition at line 24 of file TimeUtils.hh.
double artdaq::TimeUtils::convertUnixTimeToSeconds | ( | time_t | inputUnixTime | ) |
Converts a Unix time to double.
inputUnixTime | A time_t Unix time variable |
Definition at line 59 of file TimeUtils.cc.
double artdaq::TimeUtils::convertUnixTimeToSeconds | ( | struct timeval const & | inputUnixTime | ) |
Converts a Unix time to double.
inputUnixTime | A struct timeval Unix time variable |
Definition at line 65 of file TimeUtils.cc.
double artdaq::TimeUtils::convertUnixTimeToSeconds | ( | struct timespec const & | inputUnixTime | ) |
Converts a Unix time to double.
inputUnixTime | A struct timespec Unix time variable |
Definition at line 71 of file TimeUtils.cc.
std::string artdaq::TimeUtils::convertUnixTimeToString | ( | time_t | inputUnixTime | ) |
Converts a Unix time to its string representation, in UTC.
inputUnixTime | A time_t Unix time variable |
Definition at line 7 of file TimeUtils.cc.
std::string artdaq::TimeUtils::convertUnixTimeToString | ( | struct timeval const & | inputUnixTime | ) |
Converts a Unix time to its string representation, in UTC.
inputUnixTime | A struct timeval Unix time variable |
Definition at line 18 of file TimeUtils.cc.
std::string artdaq::TimeUtils::convertUnixTimeToString | ( | struct timespec const & | inputUnixTime | ) |
Converts a Unix time to its string representation, in UTC.
inputUnixTime | A struct timespec Unix time variable |
Definition at line 35 of file TimeUtils.cc.
|
inline |
Get the number of seconds in the given interval
then | std::chrono::steady_clock::time_point representing start of interval |
now | std::chrono::steady_clock::time_point representing end of interval. Defaults to std::chrono::steady_clock::now() |
Definition at line 32 of file TimeUtils.hh.
|
inline |
Gets the number of microseconds in the given time interval
then | std::chrono::steady_clock::time_point representing start of interval |
now | std::chrono::steady_clock::time_point representing end of interval. Defaults to std::chrono::steady_clock::now() |
Definition at line 43 of file TimeUtils.hh.
|
inline |
Gets the number of milliseconds in the given time interval
then | std::chrono::steady_clock::time_point representing start of interval |
now | std::chrono::steady_clock::time_point representing end of interval. Defaults to std::chrono::steady_clock::now() |
Definition at line 54 of file TimeUtils.hh.
uint64_t artdaq::TimeUtils::gettimeofday_us | ( | ) |
Get the current time of day in microseconds (from gettimeofday system call)
Definition at line 51 of file TimeUtils.cc.