Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update sockets.py #62

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

update sockets.py #62

wants to merge 1 commit into from

Conversation

skychel
Copy link

@skychel skychel commented Jan 9, 2023

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

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

acooks commented Mar 25, 2023

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

@skychel
Copy link
Author

skychel commented Mar 27, 2023

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: #61

Comment on lines +38 to +48
'''
If OS Windows, then we use time.perf_counter(). Else - time.time()

'''
if PLATFORM_WINDOWS:
get_time = perf_counter
else:
get_time = time



Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @TerjeMjelde in #61 (comment)

there's no need to differentiate between Linux and Windows here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants