Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4533: timespec translation fails for times before 1970
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-09 11:13:27
#4533: timespec translation fails for times before 1970
----------------------------------------------+-----------------------------
Reporter: Philipp Huber <phu@â¦> | Owner: viboes
Type: Bugs | Status: assigned
Milestone: To Be Determined | Component: thread
Version: Boost 1.43.0 | Severity: Problem
Resolution: | Keywords: absolute time
----------------------------------------------+-----------------------------
Comment (by viboes):
Replying to [comment:6 phu@â¦]:
> Hi viboes
>
> Well, 16 month is quite a while ago...
It is always better late than never ;-)
> We do use boost intensively but have fixed already 3 bugs in different
parts of boost, all sent to this bug tracker tool but with little or no
response. So we keep on fixing every new release...
I'm trying to change this.
> We used boost for embedded linux on a hardware with broken realtime
clock. So the system time was often randomly startet and in this case it
was 1919.
>
> The timeout resulted from a calculation of some time value minus another
time value. let's say, we scheduled a timer to a specific absolute time.
The scheduler thread inspects this time value, compares it with the
current posix time and calculates how long it needs to sleep until the
timer will be signaled.
> If the scheduler is busy, it can happen that the sleep timeout, which is
basically the subtraction of two times, becomes negative. But it only
happend with the low year numbers of 1919. At least, that is what I think
caused the timeout to become negative. But I can't tell you for sure.
After 16 Month.
>
> I understand that you would like to fix the cause of the negative
timeout but as long as the timeout type allows negative values, you can
not avoid a call with negative values in general anyway.
>
> What I can tell you for sure is, that the bugfix, which I suggested
works well for us. Whether or not it is fixing the real cause of the bug.
>
> cheers
> phu
Thanks for the explanation. IIUC,and if you where using directly the
underlying platform you will need to make sure that the time given satisfy
the interface constraints and when you did a difference you will ensure
that the seconds and nanoseconds will be positive, isn't it?
I think that you will do the same when using Boost.Chrono. The best I can
do is to add an assertion so that the modification doesn't add code on
release mode.
Let me know what do you think of this resolution?
Best,
Vicente
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4533#comment:7> 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:08 UTC