handle under/overflow of time values in a more robust manner,

there may be an overflow that need to be adjusted more than once.

Pointed out by: Fabian Thylmann <fthylmann@stats.net>

Reviewed by:	eivind, jb
This commit is contained in:
Alfred Perlstein 1999-08-19 16:49:53 +00:00
parent 42cef09ba2
commit c81c6baf1d
3 changed files with 9 additions and 9 deletions

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: uthread_kern.c,v 1.19 1999/06/20 08:28:31 jb Exp $
* $Id: uthread_kern.c,v 1.20 1999/08/12 19:34:39 deischen Exp $
*
*/
#include <errno.h>
@ -458,7 +458,7 @@ __asm__("fnsave %0": :"m"(*fdata));
/*
* Check for underflow of the nanosecond field:
*/
if (ts1.tv_nsec < 0) {
while (ts1.tv_nsec < 0) {
/*
* Allow for the underflow of the
* nanosecond field:
@ -469,7 +469,7 @@ __asm__("fnsave %0": :"m"(*fdata));
/*
* Check for overflow of the nanosecond field:
*/
if (ts1.tv_nsec >= 1000000000) {
while (ts1.tv_nsec >= 1000000000) {
/*
* Allow for the overflow of the
* nanosecond field:

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: uthread_kern.c,v 1.19 1999/06/20 08:28:31 jb Exp $
* $Id: uthread_kern.c,v 1.20 1999/08/12 19:34:39 deischen Exp $
*
*/
#include <errno.h>
@ -458,7 +458,7 @@ __asm__("fnsave %0": :"m"(*fdata));
/*
* Check for underflow of the nanosecond field:
*/
if (ts1.tv_nsec < 0) {
while (ts1.tv_nsec < 0) {
/*
* Allow for the underflow of the
* nanosecond field:
@ -469,7 +469,7 @@ __asm__("fnsave %0": :"m"(*fdata));
/*
* Check for overflow of the nanosecond field:
*/
if (ts1.tv_nsec >= 1000000000) {
while (ts1.tv_nsec >= 1000000000) {
/*
* Allow for the overflow of the
* nanosecond field:

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: uthread_kern.c,v 1.19 1999/06/20 08:28:31 jb Exp $
* $Id: uthread_kern.c,v 1.20 1999/08/12 19:34:39 deischen Exp $
*
*/
#include <errno.h>
@ -458,7 +458,7 @@ __asm__("fnsave %0": :"m"(*fdata));
/*
* Check for underflow of the nanosecond field:
*/
if (ts1.tv_nsec < 0) {
while (ts1.tv_nsec < 0) {
/*
* Allow for the underflow of the
* nanosecond field:
@ -469,7 +469,7 @@ __asm__("fnsave %0": :"m"(*fdata));
/*
* Check for overflow of the nanosecond field:
*/
if (ts1.tv_nsec >= 1000000000) {
while (ts1.tv_nsec >= 1000000000) {
/*
* Allow for the overflow of the
* nanosecond field: