summaryrefslogtreecommitdiff
path: root/share/man/man9
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2020-05-20 17:21:09 +0000
committercheloha <cheloha@cvs.openbsd.org>2020-05-20 17:21:09 +0000
commit7cbaf2415d32d9423fe157f1f3c566bef61dbebf (patch)
treec07172d139c2c608fdb7c5777395b67e5b81479e /share/man/man9
parente8960cf769fbaec688d7c98c04cceeaea12592ce (diff)
timecounting: decide whether to advance offset within tc_windup()
When we resume from a suspend we use the time from the RTC to advance the system offset. This changes the UTC to match what the RTC has given us while increasing the system uptime to account for the time we were suspended. Currently we decide whether to change to the RTC time in tc_setclock() by comparing the new offset with the th_offset member. This is wrong. th_offset is the *minimum* possible value for the offset, not the "real offset". We need to perform the comparison within tc_windup() after updating th_offset, otherwise we might rewind said offset. Because we're now doing the comparison within tc_windup() we ought to move naptime into the timehands. This means we now need a way to safely read the naptime to compute the value of CLOCK_UPTIME for userspace. Enter nanoruntime(9); it increases monotonically from boot but does not jump forward after a resume like nanouptime(9).
Diffstat (limited to 'share/man/man9')
-rw-r--r--share/man/man9/microtime.916
1 files changed, 14 insertions, 2 deletions
diff --git a/share/man/man9/microtime.9 b/share/man/man9/microtime.9
index 6bc71b21f3b..fc69d8ae607 100644
--- a/share/man/man9/microtime.9
+++ b/share/man/man9/microtime.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: microtime.9,v 1.19 2019/10/22 20:19:41 cheloha Exp $
+.\" $OpenBSD: microtime.9,v 1.20 2020/05/20 17:21:07 cheloha Exp $
.\" $NetBSD: microtime.9,v 1.2 1999/03/16 00:40:47 garbled Exp $
.\"
.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 22 2019 $
+.Dd $Mdocdate: May 20 2020 $
.Dt MICROTIME 9
.Os
.Sh NAME
@@ -41,9 +41,11 @@
.Nm getnanotime ,
.Nm nanouptime ,
.Nm getnanouptime ,
+.Nm nanoruntime ,
.Nm nanoboottime ,
.Nm bintime ,
.Nm binuptime ,
+.Nm binruntime ,
.Nm binboottime
.Nd system clocks
.Sh SYNOPSIS
@@ -85,6 +87,10 @@
.Fa "struct timespec *tv"
.Fc
.Ft void
+.Fo nanoruntime
+.Fa "struct timespec *tv"
+.Fc
+.Ft void
.Fo nanoboottime
.Fa "struct timespec *tv"
.Fc
@@ -97,12 +103,18 @@
.Fa "struct bintime *tv"
.Fc
.Ft void
+.Fo binruntime
+.Fa "struct bintime *tv"
+.Fc
+.Ft void
.Fo binboottime
.Fa "struct bintime *tv"
.Fc
.Sh DESCRIPTION
This family of functions return different system clocks in various formats.
The "uptime" functions return the monotonically increasing time since boot.
+The "runtime" functions return the monotonically increasing time since boot,
+less any time spent suspended.
The "boottime" functions return the UTC time at which the system booted.
The "time" functions return the current UTC time.
The various formats for the result are specified with: