On Thu, 22-Jan-2026 at 08:31:15 -0700, Warner Losh wrote: > On Thu, Jan 22, 2026 at 1:46 AM Andre Albsmeier <[email protected]> wrote: > > > On Fri, 19-Dec-2025 at 20:37:41 +0000, Jamie Landeg-Jones wrote: > > > void <[email protected]> wrote: > > > > > > >... > > > > and so dmsg has things like > > > > > > > > [1353919] swp_pager_getswapspace(32): failed > > > > > > > > the [1353919] I guess being the timestamp. > > > > > > > > ... > > > > > > > Yes! You can get the value from sysctl kern.boottime. > > > > > > Here is a small program I wrote a while back, just call it > > > as a dmesg substitute. > > > ... > > > Cheers, Jamie > > > > > > #!/bin/sh -efu > > > set -efu > > > > > > boottime="$(/sbin/sysctl -n kern.boottime | /usr/local/bin/gawk '{printf > > "%d", gensub ("^.* sec = ([1-9][0-9]*), .*$", "\\1", 1)}')" > > > > > > [ -z "$(printf '%s' "$boottime" | /usr/bin/egrep '^0$|^[1-9][0-9]*$')" ] > > && { printf 'Invalid boottime retrieved.\n' >& 2; exit 1; } > > > > > > /sbin/dmesg "$@" | /usr/local/bin/gawk -v boottime="$boottime" ' > > > > > > { > > > uptime = gensub ("^\\[([1-9][0-9]*)\\] .*$", "\\1", 1) > > > if (uptime == $0) realtime = "??? ?? ??:??;??" > > > else realtime = strftime ("%b %d %T", uptime + boottime) > > > > > > print realtime " " $0 > > > }' > > > > FWIW, this is a patch for dmesg(1) I use. You can enable timestamp > > conversion using -t and optionally specify a different output format > > using -f "fmt". > > > > If interested for inclusion in base, I could try to re-format it > > and come up with a manpage diff... > > > > Yes. I've done a quick review inline.
I (hopefully) have implemented all your suggestions: https://github.com/freebsd/freebsd-src/pull/1985 The only open issue is: Shall we keep the rounding of the seconds or not? The error would be smaller (max 500 ms instead of 1000) but if you prefer to have it removed I'll do it... -Andre
