Changeset 5917 for branches/newapi

Show
Ignore:
Timestamp:
12/02/07 23:43:21 (12 months ago)
Author:
erijo
Message:

Handle nanosec overflow when converting between timeval and timespec.

Location:
branches/newapi/licq/src/thread
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/newapi/licq/src/thread/condition.cpp

    r5426 r5917  
    100100    abstime.tv_nsec = now.tv_usec * 1000 + ((msec % 1000) * 1000 * 1000); 
    101101 
     102    const long nanoInSec = 1 * 1000 * 1000 * 1000; 
     103    if (abstime.tv_nsec >= nanoInSec) 
     104    { 
     105      abstime.tv_nsec -= nanoInSec; 
     106      abstime.tv_sec += 1; 
     107    } 
     108 
    102109    int error; 
    103110    do 
  • branches/newapi/licq/src/thread/test/conditiontest.cpp

    r5354 r5917  
    3131 
    3232  mutex.lock(); 
    33   BOOST_CHECK_EQUAL(condition.wait(&mutex, 10), false); 
     33  BOOST_CHECK_EQUAL(condition.wait(&mutex, 0), false); 
     34  BOOST_CHECK_EQUAL(condition.wait(&mutex, 999), false); 
    3435  mutex.unlock(); 
    3536}