Project

General

Profile

Support #18369

Support #18368: CommandableFragmentGenerator Cleanup

Fix long and arcane duration_cast lines

Added by Eric Flumerfelt almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Needed Enhancements
Target version:
Start date:
11/22/2017
Due date:
% Done:

100%

Estimated time:
Experiment:
-
Co-Assignees:
Duration:

Description

I've added some convenience functions to artdaq-core/Utilities/TimeUtils.hh (included by artdaq/DAQdata/Globals.hh):

double TimeUtils::GetElapsedTime(std::chrono::steady_clock::time_point then, std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now())
size_t TimeUtils::GetElapsedTimeMilliseconds(std::chrono::steady_clock::time_point then, std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now())
size_t TimeUtils::GetElapsedTimeMicroseconds(std::chrono::steady_clock::time_point then, std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now())

These change a line like:
std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - startTime).count()
to
TimeUtils::GetElapsedTimeMicroseconds(startTime)

All duration_casts in artdaq have been replaced with GetElapsedTime calls.

History

#1 Updated by Eric Flumerfelt almost 3 years ago

I should note that the functions are declared inline and constexpr...

#2 Updated by Eric Flumerfelt almost 3 years ago

  • % Done changed from 0 to 100

#3 Updated by Eric Flumerfelt over 2 years ago

  • Status changed from Resolved to Closed
  • Target version changed from artdaq Next Release to artdaq v3_00_01


Also available in: Atom PDF