gPTP Documentation
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Timestamp Class Reference

#include <ieee1588.hpp>

Collaboration diagram for Timestamp:
Collaboration graph

Public Member Functions

 Timestamp (uint32_t ns, uint32_t s_l, uint16_t s_m, uint8_t ver=INVALID_TIMESTAMP_VERSION)
 Creates a Timestamp instance. More...
 
char * toString ()
 Copies the timestamp to the internal string in the following format: seconds_ms seconds_ls nanoseconds. More...
 
Timestamp operator+ (const Timestamp &o)
 Implements the operator '+' overloading method. More...
 
Timestamp operator- (const Timestamp &o)
 Implements the operator '-' overloading method. More...
 
void set64 (uint64_t value)
 Sets a 64bit value to the object's timestamp. More...
 

Public Attributes

uint32_t nanoseconds
 32 bit nanoseconds value
 
uint32_t seconds_ls
 32 bit seconds LSB value
 
uint16_t seconds_ms
 32 bit seconds MSB value
 
uint8_t _version
 8 bit version value
 

Detailed Description

Provides a Timestamp interface

Constructor & Destructor Documentation

Timestamp::Timestamp ( uint32_t  ns,
uint32_t  s_l,
uint16_t  s_m,
uint8_t  ver = INVALID_TIMESTAMP_VERSION 
)
inline

Creates a Timestamp instance.

Parameters
ns32 bit nano-seconds value
s_l32 bit seconds field LSB
s_m32 bit seconds field MSB
ver8 bit version field

Member Function Documentation

Timestamp Timestamp::operator+ ( const Timestamp o)
inline

Implements the operator '+' overloading method.

Parameters
oConstant reference to the timestamp to be added
Returns
Object's timestamp + o.
Timestamp Timestamp::operator- ( const Timestamp o)
inline

Implements the operator '-' overloading method.

Parameters
oConstant reference to the timestamp to be subtracted
Returns
Object's timestamp - o.
void Timestamp::set64 ( uint64_t  value)
inline

Sets a 64bit value to the object's timestamp.

Parameters
valueValue to be set
Returns
void
char* Timestamp::toString ( )
inline

Copies the timestamp to the internal string in the following format: seconds_ms seconds_ls nanoseconds.

Returns
Formated string (as a char *)

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