From nobody Fri Mar 11 11:20:39 2022 X-Original-To: current@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 4ED561A1F8FA for ; Fri, 11 Mar 2022 11:20:46 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KFNlc6D8Wz4sRc for ; Fri, 11 Mar 2022 11:20:44 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-ej1-x62a.google.com with SMTP id a8so18393085ejc.8 for ; Fri, 11 Mar 2022 03:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=0AGYX2o1qvlLqCX2oXD/DGhZQW0YTOhSESGxyyDuJoE=; b=VXqMkEfaYeaGvoQYnPbfyX7RBS4Srt7Ws0r6K9Fj9qBZU4uMFyUAhJPAVSjBYlYoIb Zfsg9cBcIuZdEvdTjTIxdAuK0MLRGyPIvCYK6SNCWfq8TB6dCuZc88CA3+IM/8jri4LS FPZtR4J0qJR4Y4Ztu9eKKdL7mo12dUWyUZWkoWqEon2Oh4ljhPifhd36WzfB9KX8dAFD Octh1OdDPz+Vzvhy3rwhhhJ1PdmZz0HleK8hrwDsTchjPMSLX8Ke7nGJzAlidbULtqyX WEstYNDsdp/gQAc90dmlduweYn8kJ1t5hXTST1Bcjaq3FBMgv0lRt0Gv9UqDdwZu89Dh cdxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=0AGYX2o1qvlLqCX2oXD/DGhZQW0YTOhSESGxyyDuJoE=; b=OfEIOVVQD61xioY7zWADJmJzvLQrR3rM1GHviU2/d3gGinZ1Kq5tnqrCW1n/bXkS47 csjS0W9de63vM9ai2Pf/RNfKGtJ+CAw5HyvRFLMkQJbbX6eFf1UU9IXlthft9cnQCt+F 7dQLDDnr8vAThDuPQql3a7xJb3PiInTzLRm/1e5Go9iPTV1nOlHAJhsfQdSQX4bOab9S wn3Rx/4zxOF4VcTQh0QpNkz4f6x9VPKltmFanB6qFf8WoyYNRd6e+vsTn6DuUzNwoUDc 9+1v8hqBx3PeZjzEFiRUY6QqjAES/+YIJxq4a+iUQUamrHkkPWv1jYn3lCnXzerjPHj8 Y4Uw== X-Gm-Message-State: AOAM5303uXQdeNsf8zV0k66SxfhOIMlCT3U6rUkQA43r7vXoQF2fNAJ8 LreonEaYYnWm1Ki8Ff5QWzPHc2oAIbs= X-Google-Smtp-Source: ABdhPJydA/pgSWWOWGFmfDRHmIE/khlTrrpK3O4OE5O1k6GO/JusU419BIMlA4gyIcDD4Pps6GW/QA== X-Received: by 2002:a17:907:d16:b0:6d6:e3b6:9cd8 with SMTP id gn22-20020a1709070d1600b006d6e3b69cd8mr8148044ejc.94.1646997642647; Fri, 11 Mar 2022 03:20:42 -0800 (PST) Received: from ernst.home (p5b3be0d9.dip0.t-ipconnect.de. [91.59.224.217]) by smtp.gmail.com with ESMTPSA id gj18-20020a170907741200b006da82539c83sm2870118ejc.73.2022.03.11.03.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 03:20:41 -0800 (PST) Date: Fri, 11 Mar 2022 12:20:39 +0100 From: Gary Jennejohn To: Hans Petter Selasky Cc: Alexander Leidinger , current@freebsd.org Subject: Re: What are the in-kernel functions to format time? Message-ID: <20220311122039.4ecff61c@ernst.home> In-Reply-To: References: <20220311104942.Horde.BX4nDaPVTH6Lz85SCVNcopM@webmail.leidinger.net> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4KFNlc6D8Wz4sRc X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=VXqMkEfa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of gljennjohn@gmail.com designates 2a00:1450:4864:20::62a as permitted sender) smtp.mailfrom=gljennjohn@gmail.com X-Spamd-Result: default: False [-0.95 / 15.00]; HAS_REPLYTO(0.00)[gljennjohn@gmail.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; SUBJECT_ENDS_QUESTION(1.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.95)[-0.949]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; RECEIVED_SPAMHAUS_PBL(0.00)[91.59.224.217:received]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(1.00)[0.998]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[current@freebsd.org]; FREEMAIL_REPLYTO(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::62a:from]; MLMMJ_DEST(0.00)[current]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, 11 Mar 2022 11:01:03 +0100 Hans Petter Selasky 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