libmapper 2.4.12
mapper::Time Class Reference

#include <mapper_cpp.h>

Public Member Functions

 Time (mpr_time time)
 
 Time (unsigned long int sec, unsigned long int frac)
 
 Time (double seconds)
 
 Time ()
 
uint32_t sec ()
 
Timeset_sec (uint32_t sec)
 
uint32_t frac ()
 
Timeset_frac (uint32_t frac)
 
Timenow ()
 
 operator mpr_time * ()
 
 operator double () const
 
Timeoperator= (Time &time)
 
Timeoperator= (double d)
 
Time operator+ (Time &addend)
 
Time operator- (Time &subtrahend)
 
Timeoperator+= (Time &addend)
 
Timeoperator+= (double addend)
 
Timeoperator-= (Time &subtrahend)
 
Timeoperator-= (double subtrahend)
 
Timeoperator*= (double multiplicand)
 
bool operator< (Time &rhs)
 
bool operator<= (Time &rhs)
 
bool operator== (Time &rhs)
 
bool operator>= (Time &rhs)
 
bool operator> (Time &rhs)
 
bool operator!= (Time &rhs)
 

Detailed Description

libmapper uses NTP timetags for communication and synchronization.

Constructor & Destructor Documentation

◆ Time() [1/4]

mapper::Time::Time ( mpr_time time)
inline

Allocate and initialize a Time object.

Parameters
timeThe mpr_time value to copy.

◆ Time() [2/4]

mapper::Time::Time ( unsigned long int sec,
unsigned long int frac )
inline

Allocate and initialize a Time object.

Parameters
secSeconds since January 1, 1900 epoch.
fracFractions of a second.

◆ Time() [3/4]

mapper::Time::Time ( double seconds)
inline

Allocate and initialize a Time object.

Parameters
secondsTime to initialize.

◆ Time() [4/4]

mapper::Time::Time ( )
inline

Allocate and initialize a Time object to the current time.

Member Function Documentation

◆ frac()

uint32_t mapper::Time::frac ( )
inline

Retrieve the fraction part of the Time.

Returns
Self.

◆ now()

Time & mapper::Time::now ( )
inline

Update to the current time.

Returns
Self.

◆ operator double()

mapper::Time::operator double ( ) const
inline

Retrieve the value translated to a double.

Returns
Self.

◆ operator mpr_time *()

mapper::Time::operator mpr_time * ( )
inline

Cast to mpr_time.

Returns
Self.

◆ operator!=()

bool mapper::Time::operator!= ( Time & rhs)
inline

Comparison inequality operator for Time objects.

Parameters
rhsThe Time object to compare.
Returns
Self.

◆ operator*=()

Time & mapper::Time::operator*= ( double multiplicand)
inline

Compound assignment multiplication operator for a Time object and a double.

Parameters
multiplicandThe multiplicand.
Returns
Self.

◆ operator+()

Time mapper::Time::operator+ ( Time & addend)
inline

Addition operator for Time objects.

Parameters
addendThe addend.
Returns
Self.

◆ operator+=() [1/2]

Time & mapper::Time::operator+= ( double addend)
inline

Compound assignment addition operator for a Time object and a double.

Parameters
addendThe addend.
Returns
Self.

◆ operator+=() [2/2]

Time & mapper::Time::operator+= ( Time & addend)
inline

Compound assignment addition operator for Time objects.

Parameters
addendThe addend.
Returns
Self.

◆ operator-()

Time mapper::Time::operator- ( Time & subtrahend)
inline

Subtraction operator for Time objects.

Parameters
subtrahendThe subtrahend.
Returns
Self.

◆ operator-=() [1/2]

Time & mapper::Time::operator-= ( double subtrahend)
inline

Compound assignment subtraction operator for a Time object and a double.

Parameters
subtrahendThe subtrahend.
Returns
Self.

◆ operator-=() [2/2]

Time & mapper::Time::operator-= ( Time & subtrahend)
inline

Compound assignment subtraction operator for Time objects.

Parameters
subtrahendThe subtrahend.
Returns
Self.

◆ operator<()

bool mapper::Time::operator< ( Time & rhs)
inline

Comparison less-than operator for Time objects.

Parameters
rhsThe Time object to compare.
Returns
Self.

◆ operator<=()

bool mapper::Time::operator<= ( Time & rhs)
inline

Comparison less-than-of-equal operator for Time objects.

Parameters
rhsThe Time object to compare.
Returns
Self.

◆ operator=() [1/2]

Time & mapper::Time::operator= ( double d)
inline

Set the value.

Parameters
dThe value to set.
Returns
Self.

◆ operator=() [2/2]

Time & mapper::Time::operator= ( Time & time)
inline

Copy the value from another Time object.

Parameters
timeThe object to copy.
Returns
Self.

◆ operator==()

bool mapper::Time::operator== ( Time & rhs)
inline

Comparison equality operator for Time objects.

Parameters
rhsThe Time object to compare.
Returns
Self.

◆ operator>()

bool mapper::Time::operator> ( Time & rhs)
inline

Comparison greater-than-or-equal operator for Time objects.

Parameters
rhsThe Time object to compare.
Returns
Self.

◆ operator>=()

bool mapper::Time::operator>= ( Time & rhs)
inline

Comparison greater-than operator for Time objects.

Parameters
rhsThe Time object to compare.
Returns
Self.

◆ sec()

uint32_t mapper::Time::sec ( )
inline

Retrieve the seconds part of the Time.

Returns
Self.

◆ set_frac()

Time & mapper::Time::set_frac ( uint32_t frac)
inline

Set the fraction part of the Time.

Parameters
fracThe value to set.
Returns
Self.

◆ set_sec()

Time & mapper::Time::set_sec ( uint32_t sec)
inline

Set the seconds part of the Time.

Parameters
secThe value to set.
Returns
Self.