Skip to content

Commit 843c191

Browse files
committed
display timestamp error in seconds in log
1 parent 6fda690 commit 843c191

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

mavlink.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,18 @@ bool MAVLink::receive_message(uint8_t *&buf, ssize_t &len, mavlink_message_t &ms
121121
}
122122
mav_printf(MAV_SEVERITY_CRITICAL, "Bad signing timestamp - replay");
123123
break;
124-
case MAVLINK_SIGNING_STATUS_OLD_TIMESTAMP:
125-
mav_printf(MAV_SEVERITY_CRITICAL, "Bad signing timestamp - old timestamp");
126-
break;
124+
case MAVLINK_SIGNING_STATUS_OLD_TIMESTAMP: {
125+
const uint8_t *psig = msg.signature;
126+
union tstamp {
127+
uint64_t t64;
128+
uint8_t t8[8];
129+
} tstamp;
130+
tstamp.t64 = 0;
131+
memcpy(tstamp.t8, psig+1, 6);
132+
double tserr = (double(tstamp.t64) - double(signing.timestamp))*1.0e-5;
133+
mav_printf(MAV_SEVERITY_CRITICAL, "Bad signing timestamp - old timestamp (%.2fs)", tserr);
134+
break;
135+
}
127136
case MAVLINK_SIGNING_STATUS_NO_STREAMS:
128137
mav_printf(MAV_SEVERITY_CRITICAL, "Bad signing timestamp - no streams");
129138
break;

0 commit comments

Comments
 (0)