THM1176InstrumentDriver  1.0
C++ API for Metrolab THM1176
MTL::Instrument::THM1176Types::CAbsoluteTimestamp Class Reference

Timestamp for a measurement. More...

#include <THM1176Types.h>

Public Member Functions

 CAbsoluteTimestamp (std::time_t Seconds=0, U64 Nanoseconds=0)
 Constructor. More...
 
CAbsoluteTimestampoperator= (const CAbsoluteTimestamp &Value)
 Assignment operator. More...
 
bool operator== (CAbsoluteTimestamp other)
 Equality operator. More...
 
bool operator!= (CAbsoluteTimestamp other)
 Inequality operator. More...
 
std::time_t seconds (void) const
 Fetch the number of seconds. More...
 
U64 nanoseconds (void) const
 Fetch the number of nanoseconds. More...
 
void clear (void)
 Clear to default values (zeroes) More...
 

Static Public Attributes

static const U64 NS_PER_SEC = 1000000000
 

Detailed Description

Timestamp for a measurement.

Note: Timestamps are returned from the instrument as the number of nanoseconds since the instrument booted, with a timer resolution of 167 ns. By adding the computer's UNIX Epoch timestamp of when the instrument booted (usually a number of seconds since 1970), we obtain an absolute measurement timestamp, with a resolution of 167 ns. This class represents such an absolute measurement timestamp as a structure, [ UNIX Epoch time, residual in nanoseconds ]. We can represent the instrument's timestamp as Ti = [ 0 s, X ns ], and the computer time as Tc = [ Y s, 0 ns ]. One can then compute the measurement timestamp as (Ti + Tc); the class automatically takes care of carry-overs from ns to s.

Definition at line 529 of file THM1176Types.h.

Constructor & Destructor Documentation

◆ CAbsoluteTimestamp()

MTL::Instrument::THM1176Types::CAbsoluteTimestamp::CAbsoluteTimestamp ( std::time_t  Seconds = 0,
U64  Nanoseconds = 0 
)

Constructor.

Parameters
[in]SecondsNumber of seconds: UNIX Epoch time, or zero for instrument's nanosecond timestamp.
[in]NanosecondsNumber of nanoseconds; automatically normalized to [ seconds, residual nanoseconds ].

Definition at line 341 of file THM1176Types.cpp.

Member Function Documentation

◆ clear()

void MTL::Instrument::THM1176Types::CAbsoluteTimestamp::clear ( void  )

Clear to default values (zeroes)

Definition at line 369 of file THM1176Types.cpp.

◆ nanoseconds()

U64 MTL::Instrument::THM1176Types::CAbsoluteTimestamp::nanoseconds ( void  ) const

Fetch the number of nanoseconds.

Definition at line 365 of file THM1176Types.cpp.

◆ operator!=()

bool MTL::Instrument::THM1176Types::CAbsoluteTimestamp::operator!= ( CAbsoluteTimestamp  other)

Inequality operator.

Definition at line 357 of file THM1176Types.cpp.

◆ operator=()

CAbsoluteTimestamp & MTL::Instrument::THM1176Types::CAbsoluteTimestamp::operator= ( const CAbsoluteTimestamp Value)

Assignment operator.

Definition at line 347 of file THM1176Types.cpp.

◆ operator==()

bool MTL::Instrument::THM1176Types::CAbsoluteTimestamp::operator== ( CAbsoluteTimestamp  other)

Equality operator.

Definition at line 353 of file THM1176Types.cpp.

◆ seconds()

std::time_t MTL::Instrument::THM1176Types::CAbsoluteTimestamp::seconds ( void  ) const

Fetch the number of seconds.

Definition at line 361 of file THM1176Types.cpp.

Member Data Documentation

◆ NS_PER_SEC

const U64 MTL::Instrument::THM1176Types::CAbsoluteTimestamp::NS_PER_SEC = 1000000000
static

Class constant: number of ns per s.

Definition at line 536 of file THM1176Types.h.


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