McStas Readout Master 0.8.0
Loading...
Searching...
No Matches
efu_time Class Reference

ESS EFU two-integer timestamp: whole seconds since the UNIX epoch plus ticks of the 88.052499 MHz readout clock within the second. More...

#include <efu_time.h>

Public Member Functions

 efu_time (const uint32_t high, const uint32_t low)
 A time equivalent to that used in the ESS Event-Formation-Unit.
 
 efu_time (const std::pair< uint32_t, uint32_t > &p)
 
 efu_time (const double time)
 Conversion from floating point time representation.
 
 efu_time ()
 Use the system clock to construct an EFU consistent time stamp.
 
uint32_t high () const
 
uint32_t low () const
 
bool operator== (const efu_time &other) const
 
bool operator< (const efu_time &other) const
 
bool operator> (const efu_time &other) const
 
bool operator>= (const efu_time &other) const
 
bool operator>= (const efu_time *other) const
 
efu_time operator+ (const efu_time &other) const
 
efu_time operator+ (const efu_time *other) const
 
efu_time operator- (const efu_time &other) const
 
efu_time operator- (const efu_time *other) const
 
uint64_t total_ticks () const
 
uint64_t total_nanoseconds () const
 
uint32_t operator/ (const efu_time &other) const
 
efu_time operator* (const uint32_t m) const
 
efu_time operator% (const efu_time &m) const
 
efu_time operator% (const efu_time *m) const
 

Static Public Member Functions

static efu_time from_nanoseconds (const uint64_t ns)
 Nanoseconds since the UNIX epoch, to the nearest tick.
 
static uint64_t now_nanoseconds ()
 The system clock, in nanoseconds since the UNIX epoch.
 

Static Public Attributes

static constexpr uint64_t ticks = 88052499
 

Protected Attributes

uint32_t _h
 
uint32_t _l
 

Friends

std::ostream & operator<< (std::ostream &os, const efu_time &dt)
 
std::ostream & operator<< (std::ostream &os, const efu_time *dt)
 

Detailed Description

ESS EFU two-integer timestamp: whole seconds since the UNIX epoch plus ticks of the 88.052499 MHz readout clock within the second.

Arithmetic keeps the tick field normalized (always less than one second's worth of ticks), matching how the EFU interprets the high/low pair.

Definition at line 19 of file efu_time.h.

Constructor & Destructor Documentation

◆ efu_time() [1/4]

efu_time::efu_time ( const uint32_t  high,
const uint32_t  low 
)
inline

A time equivalent to that used in the ESS Event-Formation-Unit.

Parameters
highseconds since the UNIX epoch, 1970-01-01 00:00
lownumber of clock ticks in a 88.052499 MHz oscillator

Definition at line 31 of file efu_time.h.

◆ efu_time() [2/4]

efu_time::efu_time ( const std::pair< uint32_t, uint32_t > &  p)
inlineexplicit

Definition at line 38 of file efu_time.h.

◆ efu_time() [3/4]

efu_time::efu_time ( const double  time)
inlineexplicit

Conversion from floating point time representation.

Parameters
timeseconds since the UNIX epoch

Definition at line 44 of file efu_time.h.

◆ efu_time() [4/4]

efu_time::efu_time ( )
inline

Use the system clock to construct an EFU consistent time stamp.

Definition at line 50 of file efu_time.h.

Member Function Documentation

◆ from_nanoseconds()

static efu_time efu_time::from_nanoseconds ( const uint64_t  ns)
inlinestatic

Nanoseconds since the UNIX epoch, to the nearest tick.

Definition at line 120 of file efu_time.h.

◆ high()

uint32_t efu_time::high ( ) const
inline

Definition at line 60 of file efu_time.h.

◆ low()

uint32_t efu_time::low ( ) const
inline

Definition at line 61 of file efu_time.h.

◆ now_nanoseconds()

static uint64_t efu_time::now_nanoseconds ( )
inlinestatic

The system clock, in nanoseconds since the UNIX epoch.

Definition at line 132 of file efu_time.h.

Referenced by Readout::update_time().

◆ operator%() [1/2]

efu_time efu_time::operator% ( const efu_time &  m) const
inline

Definition at line 151 of file efu_time.h.

◆ operator%() [2/2]

efu_time efu_time::operator% ( const efu_time *  m) const
inline

Definition at line 155 of file efu_time.h.

◆ operator*()

efu_time efu_time::operator* ( const uint32_t  m) const
inline

Definition at line 141 of file efu_time.h.

◆ operator+() [1/2]

efu_time efu_time::operator+ ( const efu_time &  other) const
inline

Definition at line 85 of file efu_time.h.

◆ operator+() [2/2]

efu_time efu_time::operator+ ( const efu_time *  other) const
inline

Definition at line 91 of file efu_time.h.

◆ operator-() [1/2]

efu_time efu_time::operator- ( const efu_time &  other) const
inline

Definition at line 95 of file efu_time.h.

◆ operator-() [2/2]

efu_time efu_time::operator- ( const efu_time *  other) const
inline

Definition at line 106 of file efu_time.h.

◆ operator/()

uint32_t efu_time::operator/ ( const efu_time &  other) const
inline

Definition at line 137 of file efu_time.h.

◆ operator<()

bool efu_time::operator< ( const efu_time &  other) const
inline

Definition at line 66 of file efu_time.h.

◆ operator==()

bool efu_time::operator== ( const efu_time &  other) const
inline

Definition at line 63 of file efu_time.h.

◆ operator>()

bool efu_time::operator> ( const efu_time &  other) const
inline

Definition at line 71 of file efu_time.h.

◆ operator>=() [1/2]

bool efu_time::operator>= ( const efu_time &  other) const
inline

Definition at line 77 of file efu_time.h.

◆ operator>=() [2/2]

bool efu_time::operator>= ( const efu_time *  other) const
inline

Definition at line 81 of file efu_time.h.

◆ total_nanoseconds()

uint64_t efu_time::total_nanoseconds ( ) const
inline

Definition at line 114 of file efu_time.h.

◆ total_ticks()

uint64_t efu_time::total_ticks ( ) const
inline

Definition at line 110 of file efu_time.h.

Friends And Related Symbol Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream &  os,
const efu_time &  dt 
)
friend

Definition at line 159 of file efu_time.h.

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream &  os,
const efu_time *  dt 
)
friend

Definition at line 163 of file efu_time.h.

Member Data Documentation

◆ _h

uint32_t efu_time::_h
protected

Definition at line 21 of file efu_time.h.

◆ _l

uint32_t efu_time::_l
protected

Definition at line 22 of file efu_time.h.

◆ ticks

constexpr uint64_t efu_time::ticks = 88052499
staticconstexpr

Definition at line 24 of file efu_time.h.


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