Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.4.0, 3.4.8, 3.5.0, 3.5.1, 3.6.0
-
None
-
None
Description
The C-client has a function called calculate_interval() in zookeeper.c, whose purpose is to determine the number of milliseconds difference between a start and end time.
Unfortunately its logic is invalid, if the number of microseconds of the end time happens to be less than the number of microseconds of the start time - which it will be about half the time, since the end time could be in the next second interval. Such a case would yield a very big negative number, making the function return an invalid value.
Instead of re-creating the wheel, the calculate_interval() should use the timersub() function from time.h if it's available - if it's not #define'd, then #define it. (it's a macro, and the source code for it is readily available)
Attachments
Issue Links
- is related to
-
ZOOKEEPER-1626 Zookeeper C client should be tolerant of clock adjustments
- Resolved