Skip to content

Commit c7eaabe

Browse files
authored
Merge pull request #454 from bitcraze/toverumar/fix_wireshark_time
pcap logging; Timestamps wrapping after 59 seconds.
2 parents 4cc9005 + b875fca commit c7eaabe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cflib/crtp/pcap.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import struct
3-
from datetime import datetime
3+
import time
44
from enum import IntEnum
55

66

@@ -139,6 +139,6 @@ def _assemble_record(self, link_type, receive, address, channel, devid, crtp_pac
139139
)
140140

141141
def _pcap_header(self, len):
142-
ts = datetime.now()
143-
144-
return struct.pack('<LLLL', ts.second, ts.microsecond, len, len)
142+
seconds = time.time()
143+
u_sec = int((seconds % 1)*1000000)
144+
return struct.pack('<LLLL', int(seconds), u_sec, len, len)

0 commit comments

Comments
 (0)