From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 12456 invoked from network); 29 Oct 2020 14:45:41 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 29 Oct 2020 14:45:41 -0000 Received: (qmail 11636 invoked by uid 550); 29 Oct 2020 14:45:39 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 11610 invoked from network); 29 Oct 2020 14:45:38 -0000 Date: Thu, 29 Oct 2020 10:45:26 -0400 From: Rich Felker To: musl@lists.openwall.com Message-ID: <20201029144526.GP534@brightrain.aerifal.cx> References: <3D3DD419-84C6-437A-930A-EAD6777C0130@padz.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3D3DD419-84C6-437A-930A-EAD6777C0130@padz.net> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] %l missing in strftime() On Thu, Oct 29, 2020 at 10:02:59AM -0400, Dj Padzensky wrote: > > Hi there- > > Long time fan, first time caller… :-) > > I noticed that, despite the man page’s claim, %l (that’s ell) is not > implemented in strftime(). This patch should do the job. > > diff --git a/src/time/strftime.c b/src/time/strftime.c > index cc53d536..78f12ae0 100644 > --- a/src/time/strftime.c > +++ b/src/time/strftime.c > @@ -104,6 +104,12 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm * > val = tm->tm_yday+1; > width = 3; > goto number; > + case 'l': > + def_pad = '_'; > + val = tm->tm_hour; > + if (!val) val = 12; > + else if (val > 12) val -= 12; > + goto number; > case 'm': > val = tm->tm_mon+1; > goto number; The 'l' format is outside the standard, but might be okay to add if we can be reasonably sure it's not going to conflict with future standard development. Rich