Bug#799476: libc6: strftime should allow extended-format timezone (ISO 8601)
Package: libc6 Version: 2.31-10 Followup-For: Bug #799476 X-Debbugs-Cc: t...@mirbsd.de Control: tags 799476 + upstream Incidentally, I came here to report precisely this (strftime(3) and date(1) not consistent wrt. GNU extensions). I’ve since added %-d and %:z to MirBSD libc’s strftime(3) — whose date(1) uses that. I’ve noticed that trying to use %:z in a locale category fails, but passing it directly to date(1) works: $ LC_TIME=de_DE.UTF-8 date +"$(LC_TIME=de_DE.UTF-8@iso8601 locale d_t_fmt)" 2021-04-04T21:34:31+02:00 (CEST), 2021-W13-7 (So) $ LC_TIME=de_DE.UTF-8@iso8601 date +%c 2021-04-04T21:34:35%:z (CEST), 2021-W13-7 (So) I thought I could get by with using "%Y-%m-%dT%H:%M:%S%z (%Z), %G-W%V-%u (%a)" but the OP makes a good point that mixing basic and extended formats is not permitted either. Please forward this upstream so it’ll be implemented. Thanks! -- System Information: Debian Release: bullseye/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'oldstable-updates'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'oldstable'), (1, 'experimental-debug'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.10.0-4-amd64 (SMP w/2 CPU threads) Kernel taint flags: TAINT_WARN Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/lksh Init: sysvinit (via /sbin/init) Versions of packages libc6 depends on: ii libcrypt1 1:4.4.18-2 ii libgcc-s1 10.2.1-6 Versions of packages libc6 recommends: ii libidn2-0 2.3.0-5 ii libnss-nis 3.1-4 ii libnss-nisplus 1.3-4 Versions of packages libc6 suggests: ii debconf [debconf-2.0] 1.5.76 ii glibc-doc 2.31-10 ii libc-l10n 2.31-10 ii locales2.31-10 -- debconf information: glibc/kernel-too-old: glibc/restart-services: * glibc/upgrade: true glibc/disable-screensaver: glibc/kernel-not-supported: * libraries/restart-without-asking: true glibc/restart-failed:
Bug#799476: libc6: strftime should allow extended-format timezone (ISO 8601)
Package: libc6 Severity: wishlist For a date in ISO 8601 extended format with "Difference between local time and UTC of day" (§4.2.5.1), the timezone can be written only as ±hh:mm or ±hh. §4.3.3d says (http://dotat.at/tmp/ISO_8601-2004_E.pdf#): "the expression shall either be completely in basic format, in which case the minimum number of separators necessary for the required expression is used, or completely in extended format, in which case additional separators shall be used in accordance with 4.1 and 4.2." strftime should be able to output the timezone with a colon so a compliant date could be produced without post-processing, and so a locale could default to an ISO 8601 date and time format (other than basic format). Perhaps a new flag could be used, e.g. "%:z". A way to output ±hh if mm==00, or ±hh:mm otherwise, may be useful too. Maybe "%3z" or "%:3z" ("unspecified" per SUSv4: "a minimum field width is specified for any conversion specifier other than C, F, G, or Y"). - Michael -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: arm64 Kernel: Linux 4.1.0-1-amd64 (SMP w/8 CPU cores) Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init) signature.asc Description: Digital signature
Bug#799476: libc6: strftime should allow extended-format timezone (ISO 8601)
On Sat, Sep 19, 2015 at 12:20:39 -0400, Michael Gold wrote: > strftime should be able to output the timezone with a colon > [...] Perhaps a new flag could be used, e.g. "%:z". > > A way to output ±hh if mm==00, or ±hh:mm otherwise, may be useful too. > Maybe "%3z" or "%:3z" Actually, I see the GNU date utility already defines formats for these: %z +hhmm numeric time zone (e.g., -0400) %:z+hh:mm numeric time zone (e.g., -04:00) %::z +hh:mm:ss numeric time zone (e.g., -04:00:00) %:::z numeric time zone with : to necessary precision (e.g., -04, +05:30) It reimplements strftime to do so. -- Michael signature.asc Description: Digital signature