From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12231 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] implement strftime GNU extension padding specifiers '_', '-' and '0' Date: Sat, 9 Dec 2017 18:27:39 -0500 Message-ID: <20171209232739.GB1627@brightrain.aerifal.cx> References: <20161122082908.11584-1-timo.teras@iki.fi> <20171209225650.GA1627@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="aYrjF+tKt+ApYAdb" X-Trace: blaine.gmane.org 1512862071 9685 195.159.176.226 (9 Dec 2017 23:27:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 9 Dec 2017 23:27:51 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-12247-gllmg-musl=m.gmane.org@lists.openwall.com Sun Dec 10 00:27:47 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1eNoX4-0002Lk-Nk for gllmg-musl@m.gmane.org; Sun, 10 Dec 2017 00:27:46 +0100 Original-Received: (qmail 12168 invoked by uid 550); 9 Dec 2017 23:27:52 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 12150 invoked from network); 9 Dec 2017 23:27:51 -0000 Content-Disposition: inline In-Reply-To: <20171209225650.GA1627@brightrain.aerifal.cx> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12231 Archived-At: --aYrjF+tKt+ApYAdb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Dec 09, 2017 at 05:56:50PM -0500, Rich Felker wrote: > If you're tired of working and waiting on this and just want me to > commit it as-is and make any improvements later, just let me know. > I'll try to adapt the (freeform, non-checking) tests I did into > something that can go into libc-test. Attached is my first draft of what could go in libc-test. It doesn't cover any subtleties of value computation, only formatting. Rich --aYrjF+tKt+ApYAdb Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="strftime.c" #include #include #include #include #include "test.h" #define T1 3724 static const struct { time_t t; const char *fmt; const char *expect; } tests[] = { { T1, "%a", "Thu" }, { T1, "%A", "Thursday" }, { T1, "%b", "Jan" }, { T1, "%B", "January" }, { T1, "%c", "Thu Jan 1 01:02:04 1970" }, { T1, "%C", "19" }, { T1, "%04C", "0019" }, //{ T1, "%+4C", "0019" }, // correct? { T1, "%d", "01" }, { T1, "%D", "01/01/70" }, { T1, "%e", " 1" }, { T1, "%F", "1970-01-01" }, { T1, "%012F", "001970-01-01" }, // { T1, "%+12F", "001970-01-01" }, //correct? { T1, "%g", "70" }, { T1, "%G", "1970" }, { T1, "%06G", "001970" }, // { T1, "%+6G", "001970" }, // correct? { T1, "%h", "Jan" }, { T1, "%H", "01" }, { T1, "%I", "01" }, { T1, "%j", "001" }, { T1, "%m", "01" }, { T1, "%M", "02" }, { T1, "%n", "\n" }, { T1, "%p", "AM" }, { T1, "%r", "01:02:04 AM" }, { T1, "%R", "01:02" }, { T1, "%s", "3724" }, { T1, "%S", "04" }, { T1, "%T", "01:02:04" }, { T1, "%u", "4" }, { T1, "%U", "00" }, { T1, "%V", "01" }, { T1, "%w", "4" }, { T1, "%W", "00" }, { T1, "%x", "01/01/70" }, { T1, "%X", "01:02:04" }, { T1, "%Y", "1970" }, { T1, "%06Y", "001970" }, // { T1, "%+6Y", "001970" }, //correct ? }; int main(int argc, char **argv) { for (size_t i=0; i