|
artdaq_core
v3_08_01
|
Namespace to hold useful time-converting functions. More...
Typedefs | |
| typedef std::chrono::duration < double, std::ratio< 1 > > | seconds |
Functions | |
| 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... | |
| 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... | |
| 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... | |
| struct timespec | get_realtime_clock () |
| Get the current time of day as a pair of seconds and nanoseconds (from clock_gettime(CLOCK_REALTIME, ...) system call) More... | |
| constexpr double | GetElapsedTime (struct timespec const &then, struct timespec now=get_realtime_clock()) |
| Get the elapsed time between two struct timespec instances. 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 22 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 66 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 72 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 78 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.
| struct timespec artdaq::TimeUtils::get_realtime_clock | ( | ) |
Get the current time of day as a pair of seconds and nanoseconds (from clock_gettime(CLOCK_REALTIME, ...) system call)
Definition at line 58 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 30 of file TimeUtils.hh.
|
inline |
Get the elapsed time between two struct timespec instances.
Note that struct timespec instances from get_realtime_clock are subject to clock adjustments and should not be relied on as precision timers!
| then | Timespec representing beginning of interval |
| now | Timespec representing end of interval. Defaults to get_realtime_clock() |
Definition at line 71 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 41 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 52 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.