Commit 9b378925 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(setup_timer): Fixed an error that caused the tv_usec field to be

	out-of-range.
parent 8d5765ff
/*
* $Id: connections.c,v 0.94 2003/07/12 09:43:17 ceder Exp $
* $Id: connections.c,v 0.95 2003/07/12 13:49:40 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -867,13 +867,16 @@ setup_timer(struct timeval *tv,
}
else
{
tv->tv_usec += 1e3 * milliseconds;
if (tv->tv_usec > 1e6)
tv->tv_sec += milliseconds / 1000;
tv->tv_usec += 1000 * (milliseconds % 1000);
if (tv->tv_usec > 1000000)
{
tv->tv_usec -= 1e6;
tv->tv_usec -= 1000000;
tv->tv_sec++;
}
}
assert(tv->tv_usec >= 0);
assert(tv->tv_usec < 1000000);
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment