Skip to content

Commit

Permalink
Merge pull request #454 from bitcraze/toverumar/fix_wireshark_time
Browse files Browse the repository at this point in the history
pcap logging; Timestamps wrapping after 59 seconds.
  • Loading branch information
ToveRumar authored May 7, 2024
2 parents 4cc9005 + b875fca commit c7eaabe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cflib/crtp/pcap.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import struct
from datetime import datetime
import time
from enum import IntEnum


Expand Down Expand Up @@ -139,6 +139,6 @@ def _assemble_record(self, link_type, receive, address, channel, devid, crtp_pac
)

def _pcap_header(self, len):
ts = datetime.now()

return struct.pack('<LLLL', ts.second, ts.microsecond, len, len)
seconds = time.time()
u_sec = int((seconds % 1)*1000000)
return struct.pack('<LLLL', int(seconds), u_sec, len, len)

0 comments on commit c7eaabe

Please sign in to comment.