[Toybox] touch -d underspecified.

enh enh at google.com
Sun Oct 16 14:16:29 PDT 2016


I always assumed it was just the same literal T as in the ISO spec:
https://en.m.wikipedia.org/wiki/ISO_8601

On Oct 16, 2016 14:02, "Rob Landley" <rob at landley.net> wrote:

> Posix
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html
> specifies -d as:
>
>   -d  date_time
>
>   Use the specified date_time instead of the current time. The option
>   argument shall be a string of the form:
>
>     YYYY-MM-DDThh:mm:SS[.frac][tz]
>
>   or:
>
>     YYYY-MM-DDThh:mm:SS[,frac][tz]
>
>   where:
> ...
>     T is the time designator, and can be replaced by a single <space>.
>
> The problem is, it doesn't say what a "time designator" is. The two
> other hits for "designator" in this page are:
>
>   If the T time designator is replaced by a <space> for the -d
>   date_time option-argument, the <space> must be quoted to prevent
>   the shell from splitting the argument.
>
> and
>
>   The -d date_time format is an ISO 8601:2000 standard complete
>   representation of date and time extended format with an optional
>   decimal point or <comma> followed by a string of digits following
>   the seconds portion to specify fractions of a second. It is not
>   necessary to recognize "[+/-]hh:mm" and "[+/-]hh" to specify
>   timezones other than local time and UTC. The T time designator in
>   the ISO 8601:2000 standard extended format may be replaced by
>   <space>.
>
> The touch man page is useless (and points me at the info page, which I'm
> not reading).
>
> Googling for "posix time designator" brought up wikipedia pages on unix
> time (numeric seconds since 1970), an "epoch coverter" web page where
> you type in a time and it converts  it, and then
> https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&
> cd=3&cad=rja&uact=8&ved=0ahUKEwj6rZrzj-DPAhVH2oMKHb94BPQQFggrMAI&url=
> http%3A%2F%2Fwww.cl.cam.ac.uk%2F~mgk25%2Fiso-time.html&usg=
> AFQjCNH7F2PiT1zZ22oAVRzQxGByEdcrfA
> is the first possibly relevant hit (isn't it FUN how google mangles
> links when you right click copy link?) but it does not include the word
> "designator". So that's nice.
>
> The _examples_ on the posix page all use "T" for the "designator", so
> that's what I made my code do when I wrote it. But somebody complained
> (who I promised to stop listening to after they complained about my
> 'wall of text" instead of just taking the "simple" memcpy->memmove
> patch), and although I'm not replying directly to them a bug report's a
> bug report...
>
> I checked what busybox is doing, and they're funneling stuff through a
> large complicated library function that hardwires in a dozen different
> formats checking them in a lage if/else staircase, and among those are
> two that accept this format with "-" or " " as "designators". (But not
> "T" which is what the posix examples use...)
>
> Does anybody know what this field is supposed to _mean_? And/or have an
> actual use case in the wild using touch -d?
>
> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20161016/5686adfe/attachment-0002.htm>


More information about the Toybox mailing list