Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Mar 2022 12:20:39 +0100
From:      Gary Jennejohn <gljennjohn@gmail.com>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        Alexander Leidinger <Alexander@leidinger.net>, current@freebsd.org
Subject:   Re: What are the in-kernel functions to format time?
Message-ID:  <20220311122039.4ecff61c@ernst.home>
In-Reply-To: <cb18f4a3-f43f-78e5-843e-b2d2aaf9fefa@selasky.org>
References:  <20220311104942.Horde.BX4nDaPVTH6Lz85SCVNcopM@webmail.leidinger.net> <cb18f4a3-f43f-78e5-843e-b2d2aaf9fefa@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 11 Mar 2022 11:01:03 +0100
Hans Petter Selasky <hps@selasky.org> wrote:

> On 3/11/22 10:49, Alexander Leidinger wrote:
> > Hi,
> > 
> > I'm looking for a function to convert bintime to a human readable format > in the kernel... and what is the usual format we use?
> > 
> > 
> > The use case for this is: if something throws a log from the kernel > about a signal, I want to know when it happened, or in terms of code see > below (tabs are most probably messed up).
> > 
> > Do we have some kind of policy in terms of kernel messages and > timestamps? Like "do not commit logging with timestamps"? I have the > code below because I needed it at least once and think something like > this (in a human readably shape) would be beneficial to have in the tree.
> >   
> 
> Hi,
> 
> I think our kernel printer doesn't support this:
> 
> sys/kern/subr_prf.c
> 

Do you mean the %zd?  kvprintf() checks for a zflag and handles the
argument as size_t or ssize_t, depending on whether the sign is
positive or negative.

However, %n isn't supported.

> If you need to extend the format, please check other OS'es too, like
> OpenBSD, NetBSD and Linux, what they support, so there won't be any
> obvious conflicts when moving code cross platforms!
> 


-- 
Gary Jennejohn



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220311122039.4ecff61c>