Snap for 4507345 from af2ee6fdc60888c860adf1bacaae078fe6018fc8 to pi-release
Change-Id: I6570aac6ac21a2f65020762c539987a1bab9cc60
diff --git a/src/adaptation/debug_nfcsnoop.cc b/src/adaptation/debug_nfcsnoop.cc
index b58554e..9466b9f 100644
--- a/src/adaptation/debug_nfcsnoop.cc
+++ b/src/adaptation/debug_nfcsnoop.cc
@@ -60,8 +60,13 @@
// Insert data
header.length = length;
header.is_received = is_received ? 1 : 0;
- header.delta_time_ms =
- last_timestamp_ms ? timestamp_us - last_timestamp_ms : 0;
+
+ uint64_t delta_time_ms = 0;
+ if (last_timestamp_ms) {
+ __builtin_sub_overflow(timestamp_us, last_timestamp_ms, &delta_time_ms);
+ }
+ header.delta_time_ms = delta_time_ms;
+
last_timestamp_ms = timestamp_us;
ringbuffer_insert(buffer, (uint8_t*)&header, sizeof(nfcsnooz_header_t));