Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Oct 2017 08:48:16 +0200
From:      Sebastian Huber <sebastian.huber@embedded-brains.de>
To:        freebsd-hackers@freebsd.org
Cc:        kib@freebsd.org
Subject:   [PATCH] Simplify th_bintime update in tc_windup()
Message-ID:  <20171011064816.20809-1-sebastian.huber@embedded-brains.de>

next in thread | raw e-mail | index | archive | help
The th_bintime, th_microtime and th_nanotime members of the timehand all
cache the last system time (uptime + boottime).  Only the format
differs.  Do not re-calculate the bintime and simply use the value used
to calculate the microtime and nanotime.

Group all the updates under the relevant comment.

Is the

"XXX shouldn't do this here.  Should force non-`get' versions."

part of the comment still valid?
---
 sys/kern/kern_tc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 088fcb41cfa..e7cfc51aff7 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -1413,10 +1413,9 @@ tc_windup(struct bintime *new_boottimebin)
 		if (bt.sec != t)
 			th->th_boottime.sec += bt.sec - t;
 	}
-	th->th_bintime = th->th_offset;
-	bintime_add(&th->th_bintime, &th->th_boottime);
 	/* Update the UTC timestamps used by the get*() functions. */
 	/* XXX shouldn't do this here.  Should force non-`get' versions. */
+	th->th_bintime = bt;
 	bintime2timeval(&bt, &th->th_microtime);
 	bintime2timespec(&bt, &th->th_nanotime);
 
-- 
2.12.3




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171011064816.20809-1-sebastian.huber>