Boost logo

Boost :

From: (noreply_at_[hidden])
Date: 2003-10-23 10:19:39

Bugs item #828980, was opened at 2003-10-23 19:19
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Alexander Nasonov (alnsn)
Assigned to: Nobody/Anonymous (nobody)
Summary: comparisons in libs/thread/src/timeconv.inl

Initial Comment:
I alreary posted this bug to boost-devel:
no replies.
I see sourceforge bug system is alive. So I'm posting here.

In some cases ts.tv_nsec may have been assigned
NANOSECONDS_PER_SECOND ( == 1000000000). IMHO, more
correct behavoir is to increment ts.tv_sec and set
ts.tv_nsec to 0.

For example, to_timespec_duration has such code fragment:

if(ts.tv_nsec > static_cast<const
    ts.tv_sec += ts.tv_nsec / NANOSECONDS_PER_SECOND;
    ts.tv_nsec %= NANOSECONDS_PER_SECOND;

which doesn't affect ts.tv_nsec if it is eqeal to
To avoid this effect less operator in first line should
be replaced with less-equal operator.
There are several similar places where ts.tv_nsec is
assigned in this inapropriate way. Not sure that they
all are in timeconv.inl file.

PS. after looking at the function one more time I
discovered that ts.tv_nsec is assigned a difference
between two nsec values. Can ts.tv_nsec ever reach
NANOSECONDS_PER_SECOND? Anyway, other functions should
be checked against this behavior.

PPS. Why there are no bug priorities list in the form?


You can respond by visiting:

This email is sponsored by: The Donation Program.
Do you like what is doing for the Open
Source Community? Make a contribution, and help us add new
features and functionality. Click here:
Boost-bugs mailing list

Boost list run by bdawes at, gregod at, cpdaniel at, john at