From nobody Tue Jul 02 17:29:02 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WD8z25SnFz5Nqnb; Tue, 02 Jul 2024 17:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WD8z24yCjz4PX7; Tue, 2 Jul 2024 17:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719941342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=unNK9YirE7awLWpTW8pPwEapjOtdJMryeRj2oXg9XTg=; b=k1vQPZ2y6an26SqMpNCAynn4pZjCf6C/MSeEnHEW0yVw3bGxCoJQVW5okU1ZUKrPXYiaJY SimAgaUIvtsYydXFnnhyO0M1EEKFUJ4yFJnjDqna8dWi4tQtMn8wVUOWXCQg26UTZ1d9sc Ztq/RJIAQJtznrM2VpugBWwbqXf0MNxmCy/+V6+1yMxQlGuATos1H95gL7IqhbqQhxaulG Voh9A2gKTC1xQ8lhkvP9Ux414xHAoUnyUSBf0MD7AYwX8Urp6spMncF9uZ0F7/1kwO6qlj upOafMa9J+l9JnUy9Jj0hMvf2toz7XU/spY7v3h5uxu66iOmWSCadU1Q83UW6A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719941342; a=rsa-sha256; cv=none; b=Cp98mTwKzqqJpyHRNYGf9CkvkvOpESGL95D1loqj4iuGgqq1XiaDKbJx1Y0c54vEeEpv7Y MQrCMqW8ulSyHqF4rXuKxXqkD8QAsmGec4xv9JW58CKcjAEaYyRgnM8wavEH2wfAXUitOx 3fqKGBd55U8MW7cXynkO5vy+Tt1XTXThw+R16AlB7EHrQPrpLqUYFQeL3gDv1ipz4KZDzS EOkwc/1xFotViLAbi8qIcFf2JYW1U8B7SdIdQ6fgUruEC0uc3VsUHWQN76aIxCq205AMH3 pjWhi6Vyn/z+OrXnC1T6GFZyV9noqpwuk/XohLiIV2MJJ8HTjrUssDVTMHo/fg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719941342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=unNK9YirE7awLWpTW8pPwEapjOtdJMryeRj2oXg9XTg=; b=yGuK6iZwz7b+J4NbY0hgIKzEwq+M7xyJD7nIdLScGuW031a9Dr/pAbzn3JUxLiUmXJl1Li SO5+ETvTcTIhgPZPO7Sv0RRKZW0VAqvvZcKsPJlsCtQ5lt9ta9TZLfFnL3OF2LDcKCvOlV MTSnl8hgo6W1QN8IV87Pgk3Z5QPF2AZAsbcC3sf7Q9D8yi27HSNlJXoQEEkUvIRO3lnn7a fOENo2x0MPWNthFQ4PiWaiB2Vvc8CCbw1nz2o9CKn8on7QiN4sYKrNVyJRngNzK9XBj9k6 LoYqeg6LDedbPszIDv4iBeNBxKJr/yMF5mIN3KbxuI0DwhwFirqdCohVlzV9kg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WD8z24ZDDzwtV; Tue, 2 Jul 2024 17:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 462HT258029226; Tue, 2 Jul 2024 17:29:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 462HT2Q4029223; Tue, 2 Jul 2024 17:29:02 GMT (envelope-from git) Date: Tue, 2 Jul 2024 17:29:02 GMT Message-Id: <202407021729.462HT2Q4029223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: de1e91339b17 - main - clock_gettime: Catch up with the CLOCK_BOOTTIME changes List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de1e91339b17171e020029e1d49f361aa66c5146 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=de1e91339b17171e020029e1d49f361aa66c5146 commit de1e91339b17171e020029e1d49f361aa66c5146 Author: Warner Losh AuthorDate: 2024-06-28 16:55:23 +0000 Commit: Warner Losh CommitDate: 2024-07-02 17:27:35 +0000 clock_gettime: Catch up with the CLOCK_BOOTTIME changes When CLOCK_BOOTTIME was made an alias for CLOCK_MONOTONIC, the man page wasn't updated. Update to include the changed semantics (it was to be better compatible with Linux). Clarify the details of these clocks. Provide a reference to the UTC standard, and a clarifying remark about leap second encoding (fun fact: POSIX provides no unique value for these, nor definitive values to use). Sponsored by: Netflix --- lib/libsys/clock_gettime.2 | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/lib/libsys/clock_gettime.2 b/lib/libsys/clock_gettime.2 index 82f6615e8b93..fcdc5be498f2 100644 --- a/lib/libsys/clock_gettime.2 +++ b/lib/libsys/clock_gettime.2 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 27, 2023 +.Dd June 28, 2024 .Dt CLOCK_GETTIME 2 .Os .Sh NAME @@ -67,18 +67,26 @@ as well as the following values: .It Dv CLOCK_REALTIME_PRECISE .It Dv CLOCK_REALTIME_FAST .It Dv CLOCK_REALTIME_COARSE -Increments as a wall clock should. +Increments in SI seconds like a wall clock. +It uses a 1970 epoch and implements the UTC timescale. +The count of physical SI seconds since 1970, adjusted by subtracting the number +of positive leap seconds and adding the number of negative leap seconds. +Behavior during a leap second is not defined by and POSIX standard. .It Dv CLOCK_MONOTONIC .It Dv CLOCK_MONOTONIC_PRECISE .It Dv CLOCK_MONOTONIC_FAST .It Dv CLOCK_MONOTONIC_COARSE -Increments in SI seconds. +.It Dv CLOCK_BOOTTIME +Increments in SI seconds, even while the system is suspended. +Its epoch is unspecified. +The count is not adjusted by leap seconds. +.Fx implements .It Dv CLOCK_UPTIME .It Dv CLOCK_UPTIME_PRECISE .It Dv CLOCK_UPTIME_FAST -.It Dv CLOCK_BOOTTIME -Starts at zero when the kernel boots and increments -monotonically in SI seconds while the machine is running. +Increments monotonically in SI seconds while the machine is running. +The count is not adjusted by leap seconds. +The epoch is unspecified. .It Dv CLOCK_VIRTUAL Increments only when the CPU is running in user mode on behalf of the calling process. @@ -94,6 +102,7 @@ Returns the execution time of the calling thread. .El .Pp The clock IDs +.Dv CLOCK_BOOTTIME , .Dv CLOCK_REALTIME , .Dv CLOCK_MONOTONIC , and @@ -122,7 +131,7 @@ systems. Finally, .Dv CLOCK_BOOTTIME is an alias for -.Dv CLOCK_UPTIME +.Dv CLOCK_MONOTONIC for compatibility with other systems and is unrelated to the .Fa kern.boottime .Xr sysctl 8 . @@ -186,19 +195,28 @@ The and .Fn clock_getres system calls conform to -.St -p1003.1b-93 . +.St -p1003.1-2008 . The clock IDs -.Dv CLOCK_REALTIME_FAST , -.Dv CLOCK_REALTIME_PRECISE , +.Dv CLOCK_BOOTTIME , .Dv CLOCK_MONOTONIC_FAST , .Dv CLOCK_MONOTONIC_PRECISE , +.Dv CLOCK_REALTIME_FAST , +.Dv CLOCK_REALTIME_PRECISE , +.Dv CLOCK_SECOND .Dv CLOCK_UPTIME , .Dv CLOCK_UPTIME_FAST , -.Dv CLOCK_UPTIME_PRECISE , -.Dv CLOCK_SECOND +and +.Dv CLOCK_UPTIME_PRECISE are .Fx extensions to the POSIX interface. +.Pp +UTC is defined by ITU-R TF.460-6, Standard-frequency and time-signal emissions. +However, the +.Vt time_t +type is a simple count that does not provide a unique encoding for leap seconds, +nor a specification for what values should be used to encode a leap second. +.Pp .Sh HISTORY The .Fn clock_gettime ,