ValentinBELYN / icmplib

Easily forge ICMP packets and make your own ping and traceroute.
GNU Lesser General Public License v3.0
266 stars 46 forks source link

update sockets.py #62

Open skychel opened 1 year ago

skychel commented 1 year ago

If the library is used in Windows, then change time.time() to time.perf_counter()

acooks commented 1 year ago

Hi @skychel Please explain what this change is intended to fix or improve. Why is it relevant?

skychel commented 1 year ago

Hi, In short: when using the ICMPLIB in Windows, the patch allows you to correctly display small (up to 10 ms) RTT.

If a little more: When using the library in Windows OS, if the rtt is less than 5-10 ms, the regular time.time() function does not cope with the task and round-trip times (rtt) is displayed as zero.

We encountered this behavior when we decided to use ICMPLIB to monitoring a large network in the city. And this very simple patch allows you to see the real RTT value, not the null value.

I'm sorry if I didn't disclose this topic well in: https://github.com/ValentinBELYN/icmplib/issues/61