[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: date: new options to parse input date with strptime(3)
From: |
Pádraig Brady |
Subject: |
Re: date: new options to parse input date with strptime(3) |
Date: |
Wed, 31 Jul 2019 14:59:42 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 26/07/19 08:29, Assaf Gordon wrote:
> Hello,
>
> Some time ago there was a discussion relating to diffuculties of using
> GNU date's parsing. There was a mention of how using strptime(3) makes
> parsing explicit and easy.
>
> I like that idea, and decided to try my hand at adding such options.
>
> Attached is a proof of concept.
>
> The first patch adds '--date-format=FORMAT', where FORMAT is
> strptime(3) format.
I like this, and think it's useful functionality.
It's equivalent to -f in date(1) on FreeBSD,
so we should probably support that short option
> The second patch adds '--arith-format=FORMAT', where FORMAT is limited
> to years/months/days/hours/minutes/seconds (%Y/%m/%d/%H/%M/%S).
The idea here is to support more generic numeric deltas.
I'm not sure of the interface though. Perhaps --delta-format
would be clearer. Or perhaps we should just support the
FreeBSD -v option to apply the adjustments, which seems more direct
and would further improve compat.
cheers,
Pádraig