adafruit / Adafruit_BLESniffer_Python

Python API for Adafruit's Bluefruit LE Sniffer
Other
101 stars 51 forks source link

Use time.time rather than time.clock to get current packet time #5

Closed radii closed 7 years ago

radii commented 9 years ago

The time.clock function returns the CPU time used by the process, rather than the current system time. To get the system time (which is what we want to put in the pcap file) use the time.time() function instead.

ckuethe commented 7 years ago

@ladyada @microbuilder - any word on merging this?

ckuethe commented 7 years ago

Additionally, if you meant to do relative timing (between packets), you'd still want to use time.time() to get the wall time first.

ladyada commented 7 years ago

@ckuethe i havent had a moment to test but ill merge it if you say it works :) does it work?

ckuethe commented 7 years ago

Yes, it works - attached screenshot shows the difference between the time.clock() and time.time() based timings. I'll have a PR shortly to add a relative timestamp mode.

screenshot_2016-11-21_10-36-29

ladyada commented 7 years ago

kk!