Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Nov 2020 09:31:57 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Ian Lepore <ian@freebsd.org>
Cc:        "freebsd-arch@FreeBSD.org" <freebsd-arch@freebsd.org>
Subject:   Re: sbintime_t in userland
Message-ID:  <CANCZdfq0EP-KV__4R4gHJJ-oqAMQvWSE%2BeEDKVpvG29TmZuCjA@mail.gmail.com>
In-Reply-To: <567389bbf8882800c86a9cd8a502051af48cc4ec.camel@freebsd.org>
References:  <567389bbf8882800c86a9cd8a502051af48cc4ec.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Nov 28, 2020, 8:53 AM Ian Lepore <ian@freebsd.org> wrote:

> I notice everything related to sbintime_t in sys/time.h is in the
> public part of the header file (not protected by #ifdef _KERNEL).  As
> near as I can tell, no existing userland software uses this type, and
> no userland<->kernel APIs involve sbintime_t.
>
> I have a situation where I need to timestamp events relative to each
> other in the kernel and report those timestamps to userland.
> sbintime_t would be an ideal compact format for the data, and
> sbinuptime() would be a fine way to obtain the timestamps in the
> kernel.
>
> Before breaking new ground like this I thought I'd solicit opinions: is
> it a bad idea to export sbintime_t values from the kernel like this?
>

This is fine.

If it's considered okay, a second question would be: is it okay to
> document that they are on the 'uptime timescale' (meaning userland
> could translate them to UTC timestamps by determining the offset
> between CLOCK_REALTIME and CLOCK_MONOTONIC)?
>

You'd have to publish the offset for this series of timestamps. And an ntpd
time step would require an update to do completely right... The frequency
adjustments are already swizzled in, though. Granted, those are rare
enough, but the condition should at least be documented. In many ways, time
steps are like leap seconds, though at irregular times and without :60 to
worry about. Backwards steps lead to ambiguous UTC time stamps...

Warner

-- Ian
>
>
> _______________________________________________
> freebsd-arch@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfq0EP-KV__4R4gHJJ-oqAMQvWSE%2BeEDKVpvG29TmZuCjA>