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: rwightman@… 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)

comment:1 by martin@…, 13 years ago

Milestone: Boost 1.37.0Boost 1.41.0
Version: Boost 1.36.0Boost 1.40.0

I've encountered this issue in the latest 1.40 release as well. Are there any plans to fix it for 1.41?

in reply to:  1 comment:2 by viboes, 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 anonymous, 13 years ago

Owner: changed from Anthony Williams to chris_kohlhoff

comment:4 by chris_kohlhoff, 13 years ago

Owner: changed from chris_kohlhoff to Anthony Williams

I think this was reassigned to me by mistake.

comment:5 by anonymous, 12 years ago

Resolution: fixed
Status: newclosed

Fixed on trunk

Note: See TracTickets for help on using tickets.