Opened 14 years ago
Closed 12 years ago
#2447 closed Bugs (fixed)
get_due_time returns incorrect due_time if boost::date_time resolution is nanoseconds
Reported by: | Owned by: | Anthony Williams | |
---|---|---|---|
Milestone: | Boost 1.41.0 | Component: | thread |
Version: | Boost 1.40.0 | Severity: | Problem |
Keywords: | Cc: |
Description
There is a bug in the calculation of due_time (line 343 in thread.cpp) where the calculation to add the fractional seconds will always add 0 if the boost::date_time library has been configured to use nanosecond resolution.
The integer division of hundred_nanoseconds_in_one_second/target_time.abs_time.time_of_day().ticks_per_second() will be 0 when date_time uses nanosecond resolution since the denominator will be 109 and always greater than the numerator which is 107. At the default date_time resolution of 106 this works fine.
Facilities like boost::condition::timed_wait which rely on this function will not block for the desired amount of time if the wait time is < 1 sec.
This issue has been present since 1.35.0.
Change History (5)
follow-up: 2 comment:1 by , 13 years ago
Milestone: | Boost 1.37.0 → Boost 1.41.0 |
---|---|
Version: | Boost 1.36.0 → Boost 1.40.0 |
comment:2 by , 13 years ago
Replying to martin@…:
I've encountered this issue in the latest 1.40 release as well. Are there any plans to fix it for 1.41?
Hi,
I was wondering if you have a patch to solve this issue.
comment:3 by , 13 years ago
Owner: | changed from | to
---|
I've encountered this issue in the latest 1.40 release as well. Are there any plans to fix it for 1.41?