* [musl] strftime missing some format verbs
@ 2024-02-28 12:54 Jan Mercl
0 siblings, 0 replies; only message in thread
From: Jan Mercl @ 2024-02-28 12:54 UTC (permalink / raw)
To: musl
Hi list,
while testing SQLite 3.45.1 with a transpilled-to-Go version of musl
libc, date4.test (from the SQLite Tcl test suite) reports errors. The
reason is the lack of support for the %l, %k and %P format verbs. The
tests pass with this patch:
--- ./musl-80e3b09823a1d718664bc13704f3f7c19038a19e/src/time/strftime.c
2024-02-26 21:23:01.000000000 +0100
+++ ./internal/overlay/musl/src/time/strftime.c 2024-02-28
13:28:36.239990577 +0100
@@ -96,6 +96,8 @@
case 'H':
val = tm->tm_hour;
goto number;
+ case 'l':
+ def_pad = '_';
case 'I':
val = tm->tm_hour;
if (!val) val = 12;
@@ -105,6 +107,10 @@
val = tm->tm_yday+1;
width = 3;
goto number;
+ case 'k':
+ val = tm->tm_hour;
+ def_pad = '_';
+ goto number;
case 'm':
val = tm->tm_mon+1;
goto number;
@@ -117,6 +123,14 @@
case 'p':
item = tm->tm_hour >= 12 ? PM_STR : AM_STR;
goto nl_strcat;
+ case 'P':
+ item = tm->tm_hour >= 12 ? PM_STR : AM_STR;
+ fmt = __nl_langinfo_l(item, loc);
+ char *d = *s;
+ for (*l = 0; *fmt; (*l)++) {
+ *d++ = tolower(*fmt++);
+ }
+ return *s;
case 'r':
item = T_FMT_AMPM;
goto nl_strftime;
Those verbs seem to be not part of POSIX, so maybe musl does not
support them intentionally.
Regards,
-j
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-28 12:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28 12:54 [musl] strftime missing some format verbs Jan Mercl
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).