CustusX
16.5.0-rc9
An IGT application
|
#include <cxStreamedTimestampSynchronizer.h>
Public Member Functions | |
StreamedTimestampSynchronizer () | |
void | syncToCurrentTime (ImagePtr imgMsg) |
void | addTimestamp (QDateTime timestamp) |
void | addTimestamp (double timestamp) |
double | getShift () const |
Process a stream of incoming timestamps, and generate a mean shift that synchronizes their time to this computer.
Use case: Timestamp series coming from another remote computer not synced to the clock of this computer should be run through this algorithm. This because CustusX stores its own timestamps during acquisition.
If the remote is in sync, either because it is localhost or otherwise synced using e.g. "sudo ntpdate -u time.euro.apple.com" on both machines or similar, this is not necessary.
Definition at line 62 of file cxStreamedTimestampSynchronizer.h.
cx::StreamedTimestampSynchronizer::StreamedTimestampSynchronizer | ( | ) |
Definition at line 58 of file cxStreamedTimestampSynchronizer.cpp.
void cx::StreamedTimestampSynchronizer::addTimestamp | ( | QDateTime | timestamp | ) |
Insert a new timestamp. Use it to update the shift estimate.
Definition at line 101 of file cxStreamedTimestampSynchronizer.cpp.
void cx::StreamedTimestampSynchronizer::addTimestamp | ( | double | timestamp | ) |
Overloaded method, input is QDateTime::fromMSecsSinceEpoch(timestamp)
Definition at line 109 of file cxStreamedTimestampSynchronizer.cpp.
double cx::StreamedTimestampSynchronizer::getShift | ( | ) | const |
Get the current shift, i.e. the correction to be applied to timestamps in order to synchronize them with this computer clock.
Definition at line 85 of file cxStreamedTimestampSynchronizer.cpp.
void cx::StreamedTimestampSynchronizer::syncToCurrentTime | ( | ImagePtr | imgMsg | ) |
Utility for updating the shift based on the incoming image timestamp, and also synchronizing the image timestamp (i.e. shifting it).
Definition at line 75 of file cxStreamedTimestampSynchronizer.cpp.