Boost logo

Boost :

From: Alexander Nasonov (alnsn-mycop_at_[hidden])
Date: 2003-07-11 03:16:04


There is a less comparison in several places of time-related stuff. I
believe that less-or-equal is better. Take a look for example at if
statement here:

inline void to_timespec(const boost::xtime& xt, timespec& ts)
{
    ts.tv_sec = static_cast<int>(xt.sec);
    ts.tv_nsec = static_cast<int>(xt.nsec);
    if(ts.tv_nsec > static_cast<const int>(NANOSECONDS_PER_SECOND))
    {
        ts.tv_sec += ts.tv_nsec / NANOSECONDS_PER_SECOND;
        ts.tv_nsec %= NANOSECONDS_PER_SECOND;
    }
}

if ts.tv_nsec equal to NANOSECONDS_PER_SECOND then you should add one second
and set nanoseconds to zero.

-- 
Alexander Nasonov
Remove minus and all between minus and at from my e-mail for timely response

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk