LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evgen::details::TimeInUnits< Clock, Duration, typename > Class Template Reference
Inheritance diagram for evgen::details::TimeInUnits< Clock, Duration, typename >:
evgen::details::TimeInUnitsBase< Clock, Duration >

Classes

class  type
 

Public Types

using duration_t = art::TimeValue_t
 Type of the time duration as returned by this class. More...
 

Public Member Functions

duration_t operator() ()
 Reads and returns the current time the clock. More...
 

Static Public Member Functions

static duration_t read_clock ()
 Reads and returns the current time the clock. More...
 
static duration_t currentOffsetFromEpoch ()
 

Static Protected Member Functions

static constexpr duration_t toDuration (TimeInterval dt)
 Converts a std::chrono::duration into our duration metric. More...
 
static constexpr auto periodToDuration ()
 Returns the duration (duration_t) of a period type. More...
 
static duration_t timeFromEpoch (TimePoint t)
 Returns the time elapsed from the epoch to t. More...
 

Detailed Description

template<typename Clock, typename Duration, typename = void>
class evgen::details::TimeInUnits< Clock, Duration, typename >

Class reading a clock and converting the value to a specific unit; if the unit is more precise than the clock, random padding fills the gap

Definition at line 244 of file GeneratedEventTimestamp_plugin.cc.

Member Typedef Documentation

using evgen::details::TimeInUnitsBase< Clock, Duration >::duration_t = art::TimeValue_t
inherited

Type of the time duration as returned by this class.

Definition at line 110 of file GeneratedEventTimestamp_plugin.cc.

Member Function Documentation

static duration_t evgen::details::TimeInUnitsBase< Clock, Duration >::currentOffsetFromEpoch ( )
staticinherited

Computes an approximation of the offset of the current time from the epoch.

duration_t evgen::details::TimeInUnitsBase< Clock, Duration >::operator() ( )
inlineinherited

Reads and returns the current time the clock.

Definition at line 113 of file GeneratedEventTimestamp_plugin.cc.

113 { return read_clock(); }
static duration_t read_clock()
Reads and returns the current time the clock.
static constexpr auto evgen::details::TimeInUnitsBase< Clock, Duration >::periodToDuration ( )
inlinestaticprotectedinherited

Returns the duration (duration_t) of a period type.

Definition at line 134 of file GeneratedEventTimestamp_plugin.cc.

135  { return toDuration(std::chrono::duration<Rep, Period>(1)); }
static constexpr duration_t toDuration(TimeInterval dt)
Converts a std::chrono::duration into our duration metric.
static duration_t evgen::details::TimeInUnitsBase< Clock, Duration >::read_clock ( )
inlinestaticinherited

Reads and returns the current time the clock.

Definition at line 116 of file GeneratedEventTimestamp_plugin.cc.

116 { return timeFromEpoch(Clock::now()); }
static duration_t timeFromEpoch(TimePoint t)
Returns the time elapsed from the epoch to t.
static duration_t evgen::details::TimeInUnitsBase< Clock, Duration >::timeFromEpoch ( TimePoint  t)
inlinestaticprotectedinherited

Returns the time elapsed from the epoch to t.

Definition at line 139 of file GeneratedEventTimestamp_plugin.cc.

140  { return toDuration(t.time_since_epoch()); }
static constexpr duration_t toDuration(TimeInterval dt)
Converts a std::chrono::duration into our duration metric.
static constexpr duration_t evgen::details::TimeInUnitsBase< Clock, Duration >::toDuration ( TimeInterval  dt)
inlinestaticprotectedinherited

Converts a std::chrono::duration into our duration metric.

Definition at line 126 of file GeneratedEventTimestamp_plugin.cc.

127  {
128  return static_cast<duration_t>
129  (std::chrono::duration_cast<Unit>(dt).count());
130  }
art::TimeValue_t duration_t
Type of the time duration as returned by this class.

The documentation for this class was generated from the following file: