In Scapy (which uses tcpdump to capture packets), I’m extracting timestamps from a data packet that I sent and from the ICMP reply that I got from it.
>>> icmpPacket.time
1344448836.482289
>>> dataPacket.time
1344448832.707281
>>> RTT = icmpPacket.time - dataPacket.time
>>> RTT
3.775007963180542
What’s the unit of time here? How can I have it in seconds?
The unit of time is seconds since the UNIX epoch (00:00:00 UTC on 1 January 1970). Use the
timeordatetimemodules to interpret these, depending on your needs. The latter is a higher-level module.Example:
Your
RTTvalue is thus already the difference between the two timestamps in seconds.