libptpmgmt  1.3
libptpmgmt library that provides the functionality of linuxptp pmc
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Timestamp_t Struct Reference

#include <types.h>

Public Member Functions

 Timestamp_t ()
 
 Timestamp_t (int64_t secs, uint32_t nsecs)
 
std::string string () const
 
 operator std::string () const
 
 Timestamp_t (const timespec &ts)
 
 operator timespec () const
 
void toTimespec (timespec &ts) const
 
 Timestamp_t (const timeval &tv)
 
 operator timeval () const
 
void toTimeval (timeval &tv) const
 
 Timestamp_t (float_seconds seconds)
 
void fromFloat (float_seconds seconds)
 
 operator float_seconds () const
 
float_seconds toFloat () const
 
void fromNanoseconds (uint64_t nanoseconds)
 
uint64_t toNanoseconds () const
 
bool operator== (const Timestamp_t &ts) const
 
bool eq (const Timestamp_t &ts) const
 
bool operator== (float_seconds seconds) const
 
bool eq (float_seconds seconds) const
 
bool operator< (const Timestamp_t &ts) const
 
bool less (const Timestamp_t &ts) const
 
bool operator< (float_seconds seconds) const
 
bool less (float_seconds seconds) const
 
Timestamp_toperator+ (const Timestamp_t &ts)
 
Timestamp_toperator+= (const Timestamp_t &ts)
 
Timestamp_tadd (const Timestamp_t &ts)
 
Timestamp_toperator+ (float_seconds seconds)
 
Timestamp_toperator+= (float_seconds seconds)
 
Timestamp_tadd (float_seconds seconds)
 
Timestamp_toperator- (const Timestamp_t &ts)
 
Timestamp_toperator-= (const Timestamp_t &ts)
 
Timestamp_tsubt (const Timestamp_t &ts)
 
Timestamp_toperator- (float_seconds seconds)
 
Timestamp_toperator-= (float_seconds seconds)
 
Timestamp_tsubt (float_seconds seconds)
 

Static Public Member Functions

static size_t size ()
 

Public Attributes

UInteger48_t secondsField
 
UInteger32_t nanosecondsField
 

Detailed Description

PTP Time stamp

Constructor & Destructor Documentation

◆ Timestamp_t() [1/5]

Timestamp_t::Timestamp_t ( )
inline

Default constructor

◆ Timestamp_t() [2/5]

Timestamp_t::Timestamp_t ( int64_t  secs,
uint32_t  nsecs 
)
inline

Constructor

Parameters
[in]secsSeconds
[in]nsecsNanoseconds

◆ Timestamp_t() [3/5]

Timestamp_t::Timestamp_t ( const timespec &  ts)
inline

Convert from timespec

Parameters
[in]tstimespec structure
Note
scripts should not use the timespec structure

◆ Timestamp_t() [4/5]

Timestamp_t::Timestamp_t ( const timeval &  tv)

Convert from timeval

Parameters
[in]tvtimeval structure
Note
scripts should not use the timeval structure

◆ Timestamp_t() [5/5]

Timestamp_t::Timestamp_t ( float_seconds  seconds)
inline

Convert from seconds with fractions

Parameters
[in]secondswith fractions

Member Function Documentation

◆ add() [1/2]

Timestamp_t& Timestamp_t::add ( const Timestamp_t ts)

Add another clock time

Parameters
[in]tsanother clock time
Returns
reference to itself

◆ add() [2/2]

Timestamp_t& Timestamp_t::add ( float_seconds  seconds)

Add a seconds with fractions

Parameters
[in]seconds
Returns
reference to itself

◆ eq() [1/2]

bool Timestamp_t::eq ( const Timestamp_t ts) const
inline

Compare to another clock time

Parameters
[in]tsanother clock time
Returns
true if the same time

◆ eq() [2/2]

bool Timestamp_t::eq ( float_seconds  seconds) const

Compare to seconds with fractions

Parameters
[in]seconds
Returns
true if the same time
Note
due to pressision, the compare use +-1 nanosecond of value

◆ fromFloat()

void Timestamp_t::fromFloat ( float_seconds  seconds)

Convert from seconds with fractions

Parameters
[in]secondswith fractions

◆ fromNanoseconds()

void Timestamp_t::fromNanoseconds ( uint64_t  nanoseconds)

Convert from nanoseconds

Parameters
[in]nanoseconds

◆ less() [1/2]

bool Timestamp_t::less ( const Timestamp_t ts) const
inline

Compare to another clock time

Parameters
[in]tsanother clock time
Returns
true if smaller then other time

◆ less() [2/2]

bool Timestamp_t::less ( float_seconds  seconds) const

Compare to seconds with fractions

Parameters
[in]seconds
Returns
true if smaller

◆ operator float_seconds()

Timestamp_t::operator float_seconds ( ) const
inline

Convert to seconds with fractions

Note
scripts can use the toFloat() method

◆ operator std::string()

Timestamp_t::operator std::string ( ) const
inline

Convert to string of seconds with fractions

Note
scripts can use the string() method

◆ operator timespec()

Timestamp_t::operator timespec ( ) const
inline

Convert to timespec

Note
scripts should not use the timespec structure

◆ operator timeval()

Timestamp_t::operator timeval ( ) const
inline

Convert to timespec

Note
scripts should not use the timeval structure
Trunc nanosecods to microseconds Could result zero microseconds from a small nanosecods value

◆ operator+() [1/2]

Timestamp_t& Timestamp_t::operator+ ( const Timestamp_t ts)
inline

Add another clock time

Parameters
[in]tsanother clock time
Returns
reference to itself

◆ operator+() [2/2]

Timestamp_t& Timestamp_t::operator+ ( float_seconds  seconds)
inline

Add a seconds with fractions

Parameters
[in]seconds
Returns
reference to itself

◆ operator+=() [1/2]

Timestamp_t& Timestamp_t::operator+= ( const Timestamp_t ts)
inline

Add another clock time

Parameters
[in]tsanother clock time
Returns
reference to itself

◆ operator+=() [2/2]

Timestamp_t& Timestamp_t::operator+= ( float_seconds  seconds)
inline

Add a seconds with fractions

Parameters
[in]seconds
Returns
reference to itself

◆ operator-() [1/2]

Timestamp_t& Timestamp_t::operator- ( const Timestamp_t ts)
inline

Subtract another clock time

Parameters
[in]tsanother clock time
Returns
reference to itself

◆ operator-() [2/2]

Timestamp_t& Timestamp_t::operator- ( float_seconds  seconds)
inline

Subtract seconds with fractions

Parameters
[in]seconds
Returns
reference to itself

◆ operator-=() [1/2]

Timestamp_t& Timestamp_t::operator-= ( const Timestamp_t ts)
inline

Subtract another clock time

Parameters
[in]tsanother clock time
Returns
reference to itself

◆ operator-=() [2/2]

Timestamp_t& Timestamp_t::operator-= ( float_seconds  seconds)
inline

Subtract seconds with fractions

Parameters
[in]seconds
Returns
reference to itself

◆ operator<() [1/2]

bool Timestamp_t::operator< ( const Timestamp_t ts) const
inline

Compare to another clock time

Parameters
[in]tsanother clock time
Returns
true if smaller then other time
Note
when compare to a number, the number will be converted as seconds with fractions

◆ operator<() [2/2]

bool Timestamp_t::operator< ( float_seconds  seconds) const
inline

Compare to seconds with fractions

Parameters
[in]seconds
Returns
true if smaller

◆ operator==() [1/2]

bool Timestamp_t::operator== ( const Timestamp_t ts) const
inline

Compare to another clock time

Parameters
[in]tsanother clock time
Returns
true if the same time

◆ operator==() [2/2]

bool Timestamp_t::operator== ( float_seconds  seconds) const
inline

Compare to seconds with fractions

Parameters
[in]seconds
Returns
true if the same time
Note
due to pressision, the compare use +-1 nanosecond of value

◆ size()

static size_t Timestamp_t::size ( )
inlinestatic

Get object size

Returns
object size

◆ string()

std::string Timestamp_t::string ( ) const

Convert to string

Returns
string

◆ subt() [1/2]

Timestamp_t& Timestamp_t::subt ( const Timestamp_t ts)

Subtract another clock time

Parameters
[in]tsanother clock time
Returns
reference to itself

◆ subt() [2/2]

Timestamp_t& Timestamp_t::subt ( float_seconds  seconds)
inline

Subtract seconds with fractions

Parameters
[in]seconds
Returns
reference to itself

◆ toFloat()

float_seconds Timestamp_t::toFloat ( ) const

Convert to seconds with fractions

Returns
seconds with fractions

◆ toNanoseconds()

uint64_t Timestamp_t::toNanoseconds ( ) const

Convert to nanoseconds

Returns
nanoseconds

◆ toTimespec()

void Timestamp_t::toTimespec ( timespec &  ts) const
inline

Convert to timespec

Parameters
[in,out]tstimespec structure
Note
scripts should not use the timespec structure

◆ toTimeval()

void Timestamp_t::toTimeval ( timeval &  tv) const

Convert to timeval

Parameters
[in,out]tvtimeval structure
Note
scripts should not use the timeval structure
Trunc nanosecods to microseconds Could result zero microseconds from a small nanosecods value

Member Data Documentation

◆ nanosecondsField

UInteger32_t Timestamp_t::nanosecondsField

nanoseconds

◆ secondsField

UInteger48_t Timestamp_t::secondsField

seconds


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