简体   繁体   中英

Mac Address Timestamp python

I have this silly question. I analyze data packets with scapy. And there is a variable inside the packet, it's called timestamp (TSFT) , which is the time that the packet was constructed. So i grab that vairable (packet[RadioTap].TSFT) but I do not know if the value is in nanoseconds or in microseconds.

Could anyone inform me ? I haven't seen it anywhere.

Thanks in advance.

It's in microseconds. From http://www.radiotap.org/defined-fields/TSFT :

Value in microseconds of the MAC's 64-bit 802.11 Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC. For received frames only.

The timestamp is in seconds.

You can import datetime in python and use its fromtimestamp method to get it in a easier to read format like so.

import datetime ts = datetime.datetime.fromtimestamp(1305354670.602149) print ts 2011-05-14 02:31:10.602149

Hope this helped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM