Re: [Boost-bugs] [Boost C++ Libraries] #8960: condition_wariable::wait_for throws exception (with Invalid argument), if system date/time < 1970

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8960: condition_wariable::wait_for throws exception (with Invalid argument), if system date/time < 1970
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-08-03 19:27:20


#8960: condition_wariable::wait_for throws exception (with Invalid argument), if
system date/time < 1970
-------------------------------+----------------------
  Reporter: anonymous | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.53.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+----------------------

Comment (by albel78@…):

 have some problems to reproduce, because busybox applet 'date' has builtin
 value check,
 and set system date to any value < 01-01-1970 is currently impossible.

 this issue caused on development board
 (D2-plug,http://www.globalscaletechnologies.com/t-d2plugdetails.aspx)

 I don't know about a reason, but 3 days ago system time was changed to May
 1948.
 (rtc chip, or something else - i don't know).
 Then i catched exceptions on condition_variables.
 Then long time debugging, and i find reason of EINVAL of
 pthread_cond_timed_wait:
 bad value of timespec (big negative value of tv_sec),
 which is result of this code (pthread/condition_variable.hpp):

 {{{
         template <class lock_type, class Clock, class Duration>
         cv_status
         wait_until(
                 lock_type& lock,
                 const chrono::time_point<Clock, Duration>& t)
         {
           using namespace chrono;
           system_clock::time_point s_now = system_clock::now();
           typename Clock::time_point c_now = Clock::now();
           wait_until(lock, s_now + ceil<nanoseconds>(t - c_now));
           return Clock::now() < t ? cv_status::no_timeout :
 cv_status::timeout;
         }

 }}}

 and one notice: exceptions throws only in child threads. condvars in main
 thread workes fine.

 now i correct system time to 2013, and all is ok.


 if you tell me easy way to set up May 1948 - i'm ready for any tests.


 (sorry for my english)
 Alexey.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8960#comment:4>
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:13 UTC