CustusX
2023.01.05-dev+develop.0da12
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 41 of file cxStreamedTimestampSynchronizer.h.
cx::StreamedTimestampSynchronizer::StreamedTimestampSynchronizer | ( | ) |
Definition at line 37 of file cxStreamedTimestampSynchronizer.cpp.
void cx::StreamedTimestampSynchronizer::addTimestamp | ( | QDateTime | timestamp | ) |
Insert a new timestamp. Use it to update the shift estimate.
Definition at line 80 of file cxStreamedTimestampSynchronizer.cpp.
void cx::StreamedTimestampSynchronizer::addTimestamp | ( | double | timestamp | ) |
Overloaded method, input is QDateTime::fromMSecsSinceEpoch(timestamp)
Definition at line 88 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 64 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 54 of file cxStreamedTimestampSynchronizer.cpp.