summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_tc.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-04-04 18:46:13 +0000
committerphk <phk@FreeBSD.org>1998-04-04 18:46:13 +0000
commit9736ec2fbf9e02ec93125f4e016a7aa251b6225a (patch)
tree096523a7fd5704a2366e23ab34db87d92d4ca7b6 /sys/kern/kern_tc.c
parent7d5c35ecb4060f3d883917be03f1403a66dfc82f (diff)
downloadFreeBSD-src-9736ec2fbf9e02ec93125f4e016a7aa251b6225a.zip
FreeBSD-src-9736ec2fbf9e02ec93125f4e016a7aa251b6225a.tar.gz
Handle double fraction overflow in nano & microtime functions (spotted by Bruce)
Use tvtohz() a place where it fits.
Diffstat (limited to 'sys/kern/kern_tc.c')
-rw-r--r--sys/kern/kern_tc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index cf25a46..72e1845 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -39,7 +39,7 @@ static volatile int print_tci = 1;
* SUCH DAMAGE.
*
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
- * $Id: kern_clock.c,v 1.62 1998/03/31 10:47:01 phk Exp $
+ * $Id: kern_clock.c,v 1.63 1998/04/04 13:25:11 phk Exp $
*/
#include <sys/param.h>
@@ -532,7 +532,7 @@ microtime(struct timeval *tv)
((u_int64_t)tc->get_timedelta(tc) * tc->scale_micro) >> 32;
tv->tv_usec += boottime.tv_usec;
tv->tv_sec += boottime.tv_sec;
- if (tv->tv_usec >= 1000000) {
+ while (tv->tv_usec >= 1000000) {
tv->tv_usec -= 1000000;
tv->tv_sec++;
}
@@ -554,7 +554,7 @@ nanotime(struct timespec *tv)
delta += ((u_int64_t)count * tc->scale_nano_i);
delta += boottime.tv_usec * 1000;
tv->tv_sec += boottime.tv_sec;
- if (delta >= 1000000000) {
+ while (delta >= 1000000000) {
delta -= 1000000000;
tv->tv_sec++;
}
OpenPOWER on IntegriCloud