mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 18:46:18 +00:00
m/3dof: Add assert for timestamp paranoia
This commit is contained in:
parent
c73146c6fd
commit
a71b3d35d1
1
doc/changes/auxiliary/mr.717.md
Normal file
1
doc/changes/auxiliary/mr.717.md
Normal file
|
@ -0,0 +1 @@
|
|||
m/3dof: Add assert to catch time traveling drivers.
|
|
@ -19,6 +19,7 @@
|
|||
#include "math/m_mathinclude.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define DUR_1S_IN_NS (1000 * 1000 * 1000)
|
||||
#define DUR_300MS_IN_NS (300 * 1000 * 1000)
|
||||
|
@ -183,6 +184,9 @@ m_imu_3dof_update(struct m_imu_3dof *f,
|
|||
return;
|
||||
}
|
||||
|
||||
// This code assumes all timestamps makes some forward progress.
|
||||
assert(timestamp_ns >= f->last.timestamp_ns);
|
||||
|
||||
f->last.gyro = *gyro;
|
||||
f->last.accel = *accel;
|
||||
|
||||
|
|
Loading…
Reference in a new issue