From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mimir.eigenstate.org ([206.124.132.107]) by ewsd; Mon May 4 00:08:20 EDT 2020 Received: from abbatoir.fios-router.home (pool-162-83-132-245.nycmny.fios.verizon.net [162.83.132.245]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id 48e25737 (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO); Sun, 3 May 2020 21:08:05 -0700 (PDT) Message-ID: <1CE411CAAB15E7AEBECDD117C02455EB@eigenstate.org> To: ori@eigenstate.org, magma698hfsp273p9f@icebubble.org, 9front@9front.org Subject: Re: [9front] Re: Date and time handling. Date: Sun, 3 May 2020 21:08:04 -0700 From: ori@eigenstate.org In-Reply-To: <301873E74608771F391ED0A660DDCFF7@eigenstate.org> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: stateless patented content-driven-oriented callback locator >> Thanks for the review. Good questions and comments! >> > > And thanks to joe9 for adding a bunch of test cases, which > now all pass. I think the code is ready for testing. > > The next step, if there aren't any objections, will be to > merge the `struct Tmd` with libc's `struct Tm`, and move > this library over to use it. > > Once we've got some experience and are happy with this, I'd > like to commit this to 9front and move utilities like date > over to it. I started rewriting seconds(1), trying to loop together a mass of permutations of date formats, and decided I hate it. I think we should do two things with seconds: 1) Pick a common list of date formats we should try, one after the other. 2) add a '-f' option (same for date) that will accept a libdate format, instead of looping through them all and trying them one by one. What formats do people use with seconds? I'd like to propose the following, cribbed from Go's constant formats, but with the addition of RFC5322 asctime: WWW MMM DD hh:mm:ss YYYY RFC5322: Note: there are a lot of variants, and I'm considering adding a '?' modifier to indicate fuzzy parsing, where '1, 01, Jan, January' would all match '?M' WWW DD MMM YYYY hh:mm:ss Z WWW DD MMMM YYYY hh:mm:ss Z WWWW DD MMM YYYY hh:mm:ss Z WWWW DD MMMM YYYY hh:mm:ss Z WWW, DD-MM-YY hh:mm:ss Z WWW, DD-MM-YY hh:mm:ss Z WWW, DD-MMM-YY hh:mm:ss Z WWW, DD-MMMM-YY hh:mm:ss Z WWWW, DD-MM-YY hh:mm:ss Z WWWW, DD-MM-YY hh:mm:ss Z WWWW, DD-MMM-YY hh:mm:ss Z WWWW, DD-MMMM-YY hh:mm:ss Z RFC822/RFC8222: DD MMM YY hh:mm ZZZ DD MMM YY hh:mm Z RFC850: WW, DD-MMM-06 hh:mm:ss MST RFC1123: WWW, DD MMM YYYY hh:mm:ss ZZZ RFC1123Z: WWW, DD MMM YYYY hh:mm:ss ZZ RFC3339: YYYY-01-DDThh:mm:ss[Z]ZZ