The Time class Is used to sync time between devices.
More...
#include <Driver/DriverComponents/Time.h>
|
| Time (pMessageProcessor messageProcessor) |
|
void | sync () |
| sync Synchronizes time between devives through calculating clock difference in ms More...
|
|
void | reset () |
| reset Resets m_timeDifference to 0 More...
|
|
int64_t | timeDifference () const |
| timeDifference Gets time difference between this pc and the Voyager in ms More...
|
|
void | addTimeSyncedCallback (const std::function< void()> &newCallback) |
| addTimeSyncedCallback Adds a callback that is called when the time is synced More...
|
|
| AbstractDriverComponent (pMessageProcessor messageProcessor) |
|
The Time class Is used to sync time between devices.
Definition at line 19 of file Time.h.
◆ Time()
Time::Time |
( |
pMessageProcessor |
messageProcessor | ) |
|
◆ addTimeSyncedCallback()
void Time::addTimeSyncedCallback |
( |
const std::function< void()> & |
newCallback | ) |
|
addTimeSyncedCallback Adds a callback that is called when the time is synced
- Parameters
-
newCallback | new callbback to call when the time is synced |
Definition at line 63 of file Time.cpp.
◆ handleTimeRequest()
void Time::handleTimeRequest |
( |
const google::protobuf::Message & |
message | ) |
|
|
protected |
◆ handleTimeResponse()
void Time::handleTimeResponse |
( |
const google::protobuf::Message & |
message | ) |
|
|
protected |
◆ mSecSinceEpoch()
uint64_t Time::mSecSinceEpoch |
( |
| ) |
const |
|
protected |
◆ reset()
◆ sync()
sync Synchronizes time between devives through calculating clock difference in ms
Definition at line 11 of file Time.cpp.
◆ timeDifference()
int64_t Time::timeDifference |
( |
| ) |
const |
timeDifference Gets time difference between this pc and the Voyager in ms
- Returns
- time difference in ms
Definition at line 59 of file Time.cpp.
◆ m_timeDifference
std::atomic<int64_t> Time::m_timeDifference |
|
private |
◆ m_timeSyncedCallbacks
std::vector<std::function<void(void)> > Time::m_timeSyncedCallbacks |
|
private |
◆ m_timeSyncedCallbacksMutex
std::mutex Time::m_timeSyncedCallbacksMutex |
|
private |