git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 5/6] date: document and test "raw-local" mode

From
Jeff King <peff@peff.net>
Date
Jul 27, 2016, 19:57 UTC
Message-ID
<20160727195703.GA8141@sigill.intra.peff.net>
In-Reply-To
<xmqq37mux3mz.fsf@gitster.mtv.corp.google.com>
On Wed, Jul 27, 2016 at 12:49:40PM -0700, Junio C Hamano wrote:
Show 12 quoted lines
> > @@ -746,7 +746,10 @@ format, often found in email messages.
> >  +
> >  `--date=short` shows only the date, but not the time, in `YYYY-MM-DD` format.
> >  +
> > -`--date=raw` shows the date in the internal raw Git format `%s %z` format.
> > +`--date=raw` shows the date in the internal raw Git format `%s %z`
> > +format. Note that the `-local` option does not affect the
> > +seconds-since-epoch value (which is always measured in UTC), but does
> > +switch the accompanying timezone value.
> 
> Not your fault, but "internal raw Git format X format" sounds a bit
> clunky.

Yeah, I also noticed that while writing the original, but it just crossed over my line of "if I fix everything I don't like, this series will never get out the door". :)

Show 11 quoted lines
> 	shows the date in `%s %z` format (seconds since 1970-01-01
> 	00:00:00 UTC, space, timezone as sign and four digits)
>         
> or something like that?  I suspect %s is not a POSIX-kosher strftime
> conversion specifier, so from that point of view, perhaps making the
> text the authoritative description and demote the format string as a
> comment to help those who know strfmt, i.e.
> 
> 	shows the date as seconds since 1970-01-01 00:00:00 UTC,
> 	space, timezone as sign and four digits (i.e. as if the
> 	timestamp were formatted with `strftime("%s %z")`).

Yeah, I think referring to "%s %z" is pretty bad, as it's meaningless to people who don't know strftime() off the top of their head, and %s isn't even portable.

The second option you've shown here is much better, and I think this is worth fixing (and it should be in a new patch, and can go on top of the others).

I'm not sure if it's worth calling out more clearly what the timezone means, since the epoch seconds are in UTC, as you noted here. The follow-on sentence explains what "-local" does, but not what it means in the non-local variant.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 16 in “reflog docs and date-formatting”
  1. 0/6 reflog docs and date-formattingJeff King, Jul 22, 2016
  2. 1/6 doc/rev-list-options: clarify "commit@{Nth}" for "-g" optionJeff King, Jul 22, 2016
  3. 2/6 doc/rev-list-options: explain "-g" output formatsJeff King, Jul 22, 2016
  4. 3/6 doc/pretty-formats: describe index/time formats for %gdJeff King, Jul 22, 2016
  5. 4/6 doc/pretty-formats: explain shortening of %gdJeff King, Jul 22, 2016
  6. 5/6 date: document and test "raw-local" modeJeff King, Jul 22, 2016
  7. Jakub NarębskiJul 23, 2016
  8. Jeff KingJul 26, 2016
  9. Jakub NarębskiJul 27, 2016
  10. 5/6 date: document and test "raw-local" modeJeff King, Jul 27, 2016
  11. Junio C HamanoJul 27, 2016
  12. Jeff KingJul 27, 2016
  13. Junio C HamanoJul 27, 2016
  14. Jeff KingJul 27, 2016
  15. Junio C HamanoJul 27, 2016
  16. 6/6 date: add "unix" formatJeff King, Jul 22, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.