Commit de436e0c authored by Thiago Santini's avatar Thiago Santini

Changes Timestamp type to double

This gives us sub millisecond precision.
Moves to ns elapsed time where pertinent.
parent a8a9ac01
......@@ -58,7 +58,8 @@ void EyeImageProcessor::process(Timestamp timestamp, const Mat &frame)
if ( gPerformanceMonitor.shouldDrop(pmIdx, timestamp, 100) )
return;
QMutexLocker locker(&cfgMutex);
QMutexLocker locker(&cfgMutex);
Timestamp processingStartNs = gTimer.nsecsElapsed();
data.timestamp = timestamp;
......@@ -130,7 +131,7 @@ void EyeImageProcessor::process(Timestamp timestamp, const Mat &frame)
}
data.cameraCalibration = cameraCalibration;
data.processingTimestamp = gTimer.elapsed() - data.timestamp;
data.processingTimestamp = ns2ms(gTimer.nsecsElapsed() - processingStartNs);
emit newData(data);
}
......
......@@ -48,6 +48,7 @@ void FieldImageProcessor::process(Timestamp timestamp, const Mat &frame)
return;
QMutexLocker locker(&cfgMutex);
Timestamp processingStartNs = gTimer.nsecsElapsed();
data.timestamp = timestamp;
......@@ -137,7 +138,7 @@ void FieldImageProcessor::process(Timestamp timestamp, const Mat &frame)
data.validGazeEstimate = false;
data.cameraCalibration = cameraCalibration;
data.processingTimestamp = gTimer.elapsed() - data.timestamp;
data.processingTimestamp = ns2ms(gTimer.nsecsElapsed() - processingStartNs);
emit newData(data);
}
......
......@@ -85,7 +85,7 @@ bool FrameGrabber::present(const QVideoFrame &frame)
* we must copy the data
*
*/
Timestamp t = gTimer.elapsed();
Timestamp t = ns2ms(gTimer.nsecsElapsed());
const QString tMetaStr = "timestamp";
if ( frame.metaData(tMetaStr).isValid() ) {
......
......@@ -128,7 +128,7 @@ void Synchronizer::synchronize(Timestamp timestamp)
//if (timestamp == 0) // old style
//timestamp = getLatestTimestamp();
if (timestamp == 0)
timestamp = gTimer.elapsed();
timestamp = ns2ms(gTimer.nsecsElapsed());
if (timestamp == maxTimestamp) // nothing recent was available
return;
......
......@@ -47,9 +47,13 @@ QString toQString(QCameraViewfinderSettings setting);
QString iniStr(QString str);
template<typename T>
T ns2ms(const T v) { return 1.0e-6 * v; }
void delay(const int &thMs);
template<typename T> void set(const QSettings *settings, const QString key, T &v)
template<typename T>
void set(const QSettings *settings, const QString key, T &v)
{
if (!settings)
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment