1 #ifndef artdaq_core_Utilities_TimeUtils_h
2 #define artdaq_core_Utilities_TimeUtils_h
24 typedef std::chrono::duration<double, std::ratio<1>>
seconds;
32 inline constexpr
double GetElapsedTime(std::chrono::steady_clock::time_point then, std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now())
34 return std::chrono::duration_cast<
seconds>(now - then).count();
43 inline constexpr
size_t GetElapsedTimeMicroseconds(std::chrono::steady_clock::time_point then, std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now())
54 inline constexpr
size_t GetElapsedTimeMilliseconds(std::chrono::steady_clock::time_point then, std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now())
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
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
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)
double convertUnixTimeToSeconds(time_t inputUnixTime)
Converts a Unix time to double.
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
std::chrono::duration< double, std::ratio< 1 > > seconds
std::string convertUnixTimeToString(time_t inputUnixTime)
Converts a Unix time to its string representation, in UTC.
uint64_t gettimeofday_us()
Get the current time of day in microseconds (from gettimeofday system call)