[Boost-bugs] [Boost C++ Libraries] #5418: Error in asio example: tick_count_timer

Subject: [Boost-bugs] [Boost C++ Libraries] #5418: Error in asio example: tick_count_timer
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-04-05 08:50:45


#5418: Error in asio example: tick_count_timer
------------------------------+---------------------------------------------
 Reporter: Peter Grimstrup | Owner: chris_kohlhoff
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 The method less_than(t1, t2) returns true if called with t1 == t2.

 {{{
 static bool less_than(const time_type& t1, const time_type& t2)
 {
     return (t2.ticks_ - t1.ticks_) < static_cast<DWORD>(1 << 31);
 }
 }}}

 I suggest replacing with the correct (and maybe a bit more efficient):

 {{{
 static bool less_than(const time_type& t1, const time_type& t2)
 {
     return (static_cast<long>(t2.ticks_) - static_cast<long>(t1.ticks_)) >
 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5418>
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:06 UTC