C++ Logo

std-proposals

Advanced search

Re: [std-proposals] New draft proposal: Add "%s" (two-digit truncated-integer seconds) as a std::format conversion specifier for std::chrono time types.

From: Thiago Macieira <thiago_at_[hidden]>
Date: Thu, 04 May 2023 07:32:34 -0700
On Wednesday, 3 May 2023 03:02:04 PDT Simon Hill via Std-Proposals wrote:
>

Quick note: while not in POSIX, %s is a standard extension in glibc[1],
FreeBSD libc[2], NetBSD[3], OpenBSD[4] (probably because 4.4BSD[5] had it),
Solaris[6] and QNX[7] to mean:

%s
    Number of seconds since the Epoch (1970–01–01).

If compatibility with strftime is desired, then please don't use %s. Maybe use
a modified second (%ES) or explicitly forcing the precision to zero.

[1] https://man7.org/linux/man-pages/man3/strftime.3.html
[2] https://man.freebsd.org/cgi/man.cgi?query=strftime&sektion=3
[3] https://man.freebsd.org/cgi/man.cgi?query=strftime&manpath=NetBSD+9.3
[4] https://man.freebsd.org/cgi/man.cgi?query=strftime&manpath=OpenBSD+7.3
[5] https://man.freebsd.org/cgi/man.cgi?query=strftime&manpath=4.4BSD+Lite2
[6] https://docs.oracle.com/cd/E36784_01/html/E36874/strftime-3c.html
[7] https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/
topic/s/strftime.html
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-05-04 14:32:36