Re: [Boost-bugs] [Boost C++ Libraries] #3504: deadline_timer (based on UTC time) is not suitable for communication timeouts

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3504: deadline_timer (based on UTC time) is not suitable for communication timeouts
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-11-08 03:50:31


#3504: deadline_timer (based on UTC time) is not suitable for communication
timeouts
--------------------------------------------+-------------------------------
  Reporter: Bjarne Laursen <bla@…> | Owner: chris_kohlhoff
      Type: Feature Requests | Status: closed
 Milestone: Boost 1.41.0 | Component: asio
   Version: Boost 1.41.0 | Severity: Problem
Resolution: wontfix | Keywords:
--------------------------------------------+-------------------------------

Comment (by kjohnson@…):

 Replying to [comment:15 Aaron_Wright@…]:
> Replying to [comment:10 kjohnson@…]:
> > I may be wrong, but I think the attached file "monotone_timer.hpp-
 NO_MUTEX" suffers from really bad roll over issues. Multiplying a rolling
 monotonic timer by a constant (1000000000/frequency.QuadPart on line 80)
 doesn't produce a valid monotonic nanosecond count.
>
> I'm investigating an issue I've had where timers have stopped firing. I
 used an implementation just like "monotone_timer.hpp-NO_MUTEX", and I was
 wanting to narrow down the cause of my problem.
>
> Would it be possible to get a little more detail about why that equation
 doesn't "produce a valid monotonic nanosecond count"? I would really
 appreciate it.

 I was wrong - it doesn't.

 It is always true that:

 ((count+n)*ns_over_freq) - (count*ns_over_freq) = (n*ns_over_freq)

 in the ring of unsigned 64-bit numbers - i.e. monotonic steps in the count
 always produce monotonic steps in the output - it just wraps around more
 often.

 I was obviously a bit confused and frustrated that day.

 I did warn you :)

 There were a couple of fixes in 1.45 that you may be interested in.

 https://svn.boost.org/trac/boost/ticket/4568

 https://svn.boost.org/trac/boost/ticket/4745

 I've moved off this now and probably can't help anymore.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3504#comment:16>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC