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

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

From
Jeff King <peff@peff.net>
Date
Jun 12, 2017, 18:20 UTC
Message-ID
<20170612182045.z4d37ph5uqqhwmas@sigill.intra.peff.net>
In-Reply-To
<CACBZZX6AH2nEGPHMq6XOLDxr4SH9v-zT_YGovLXN_ZQ+fB345g@mail.gmail.com>
On Mon, Jun 12, 2017 at 07:53:21PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 13 quoted lines
> >> Of course we can never know if you were in Tokyo or Seul from the info
> >> in the commit object, but we don't need to, it's enough that we just
> >> emit JST for +0900 and anyone reading the output has at least some
> >> idea what +0900 maps to.
> >
> > Please don't. Outputting invented information for something that
> > really isn't in the data is worse than outputting no information at
> > all.
> 
> It's not invented information. %z being +0900 is the same thing as %Z
> being JST since +0900 == JST, just because some other things are also
> == +0900 that doesn't mean that JST is invalid or less useful than
> +0900 or "" for the purposes of human-readable output.

I think the main problem is that the mapping isn't just "JST->+0900". It's a set of rules that depend on the specific time being converted. So it's true that at some time t, +0900 may mean JST or KST or whatever. But at a different time, those time zones will map to a different offset.

So I think at best this is semantically confusing (the author was not in JST, but just happened to be in a time zone that maps to the same thing at that moment, and any attempt to extrapolate their zone at another time is going to be wrong). And at worst the output of "git log" is going to show the same user flip-flopping between zones as their commits move around with respect to the (politically determined) zone changes. For instance in my time zone I'd shift between EST and CST twice per year due to DST. My real time zone is EST5EDT, or better still, America/New_York (I don't live there, but the Olson database carves up regions based on the most populous city in the zone).

-Peff
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 26 of 44 in “git-2.13.0: log --date=format:%z not working”
  1. Ulrich MuellerMay 26, 2017
  2. Ævar Arnfjörð BjarmasonMay 27, 2017
  3. Jeff KingMay 27, 2017
  4. Ævar Arnfjörð BjarmasonMay 28, 2017
  5. Junio C HamanoMay 29, 2017
  6. René ScharfeMay 28, 2017
  7. Junio C HamanoJun 2, 2017
  8. Jeff KingJun 2, 2017
  9. René ScharfeJun 2, 2017
  10. Jeff KingJun 2, 2017
  11. Ulrich MuellerJun 2, 2017
  12. Jeff KingJun 2, 2017
  13. Ulrich MuellerJun 2, 2017
  14. Jeff KingJun 2, 2017
  15. strbuf: let strbuf_addftime handle %z and %Z itselfRené Scharfe, Jun 3, 2017
  16. Ulrich MuellerJun 3, 2017
  17. René ScharfeJun 3, 2017
  18. Jeff KingJun 7, 2017
  19. date: use localtime() for "-local" time formatsJeff King, Jun 7, 2017
  20. René ScharfeJun 11, 2017
  21. Junio C HamanoJun 12, 2017
  22. Ævar Arnfjörð BjarmasonJun 12, 2017
  23. Ulrich MuellerJun 12, 2017
  24. Ævar Arnfjörð BjarmasonJun 12, 2017
  25. Junio C HamanoJun 12, 2017
  26. Jeff KingJun 12, 2017
  27. Ævar Arnfjörð BjarmasonJun 12, 2017
  28. Jeff KingJun 12, 2017
  29. Linus TorvaldsJun 13, 2017
  30. René ScharfeJun 12, 2017
  31. Ævar Arnfjörð BjarmasonJun 13, 2017
  32. Ulrich MuellerJun 13, 2017
  33. René ScharfeJun 12, 2017
  34. Jeff KingJun 12, 2017
  35. strbuf: let strbuf_addftime handle %z and %Z itselfRené Scharfe, Jun 15, 2017
  36. Ulrich MuellerJun 15, 2017
  37. René ScharfeJun 15, 2017
  38. strbuf: let strbuf_addftime handle %z and %Z itselfRené Scharfe, Jun 15, 2017
  39. Jeff KingJun 15, 2017
  40. 1/2 t0006: check --date=format zone offsetsJeff King, Jun 15, 2017
  41. 2/2 date: use localtime() for "-local" time formatsJeff King, Jun 15, 2017
  42. René ScharfeJun 15, 2017
  43. Junio C HamanoJun 15, 2017
  44. Jeff KingJun 16, 2017

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.