From a9ac5d2838f3c8d1408b45a280589233895a049f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 17 Oct 2015 11:07:11 +0200 Subject: [PATCH] btsnoop: Fix timestamp assignment for little-endian packet logger format --- src/shared/btsnoop.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/shared/btsnoop.c b/src/shared/btsnoop.c index 2427f1877..212cbf7d4 100644 --- a/src/shared/btsnoop.c +++ b/src/shared/btsnoop.c @@ -342,15 +342,18 @@ static bool pklg_read_hci(struct btsnoop *btsnoop, struct timeval *tv, if (btsnoop->pklg_v2) { toread = le32toh(pkt.len) - (PKLG_PKT_SIZE - 4); + ts = le64toh(pkt.ts); + tv->tv_sec = ts & 0xffffffff; + tv->tv_usec = ts >> 32; } else { toread = be32toh(pkt.len) - (PKLG_PKT_SIZE - 4); + ts = be64toh(pkt.ts); + tv->tv_sec = ts >> 32; + tv->tv_usec = ts & 0xffffffff; } - tv->tv_sec = ts >> 32; - tv->tv_usec = ts & 0xffffffff; - *index = 0; *opcode = get_opcode_from_pklg(pkt.type); -- 2.47.3