Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Using non monotonic functions to calculate elapsed time #1546

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

Open
hagai-auro opened this issue Jul 16, 2018 · 1 comment
Open

Using non monotonic functions to calculate elapsed time #1546

hagai-auro opened this issue Jul 16, 2018 · 1 comment

Comments

@hagai-auro
Copy link

hagai-auro commented Jul 16, 2018

on master (commit 9ac3cb1) https://github.com/dpkp/kafka-python/blob/master/kafka/consumer/group.py ,
method def poll(self, timeout_ms=0, max_records=None) uses time.time() to calculate elapsed time.
time.time() does not return a monotonic clock , and therefore the elapsed time calculation could yield unexpected results.

>>> time.get_clock_info('time')
namespace(adjustable=True, implementation='clock_gettime(CLOCK_REALTIME)', monotonic=False, resolution=1.0000000000000002e-06)

the time module has several monotonic times available, but I don't believe they're available for python 2, which this library supports

@jeffwidman
Copy link
Contributor

Agreed, it'd be nice to change to a monotonic clock. But as you also note, this will be easiest to implement after we drop Python 2 support (which may be a little while): #1927

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

No branches or pull requests

2 participants