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
René Scharfe <l.s.r@web.de>
Date
Jun 12, 2017, 22:31 UTC
Message-ID
<c7532160-53eb-a0c5-94e6-483aadf0cfc5@web.de>
In-Reply-To
<CACBZZX5OQc45fUyDVayE89rkT=+8m5S4efSXCAbCy7Upme5zLA@mail.gmail.com>
Am 12.06.2017 um 21:02 schrieb Ævar Arnfjörð Bjarmason:
Show 47 quoted lines
> I only ever use the time offset info to quickly make a mental note of
> "oh +0200, this guy's in Europe", or "oh -0400 America East". Having
> any info at all for %Z would allow me to easily replace that already
> buggy mapping that exists in my head right now with something that's
> at least a bit more accurate, e.g. I remember that +0900 is Japan, but
> I can't now offhand recall what timezones India is at.
> 
> Now, obviously we can't know whether to translate e.g. -0400 to New
> York or Santiago, but for the purposes of human readable output I
> thought it would be more useful to guess than show nothing at all. So
> for that purpose the most useful output of %Z *for me* would be just
> showing a string with the 3 most notable cities/areas, weighted for
> showing locations on different continents, e.g.:
> 
>    +0000 = Iceland, West Africa, Ittoqqortoormiit
>    +0100 = London, Lisbon, Kinshasa
>    ...
>    +0900 = Tokyo, Seul, Manokwari
>    ....
>    -0900 = San Francisco, Vancouver, Tijuana
>    ....
>    -0600 = Denver, Managua, Calgary
> 
> Then I could run:
> 
>      git log --date=format-local:"%Y[...](%Z)"
> 
> And get output like:
> 
>      commit 826c06412e (HEAD -> master, origin/master, origin/HEAD)
>      Author: Junio C Hamano <gitster@pobox.com>
>      Date:   Fri Jun 2 15:07:36 2017 +0900 (San Francisco, Vancouver,
> Tijuana etc.)
> 
>      Fifth batch for 2.14
>      [...]
>      commit 30d005c020
>      Author: Jeff King <peff@peff.net>
>      Date:   Fri May 19 08:59:34 2017 -0400 (New York, Havana, Santiago etc.)
> 
>          diff: use blob path for blob/file diffs
> 
> Which gives me a pretty good idea of where the people who are making
> my colleges / collaborators who are making commits all over the world
> are located, for the purposes of reinforcing the abstract numeric
> mapping with a best-guess at what the location might be, or at least
> something that's close to the actual location.

Half the time this would be off by a zone in areas that use daylight saving time, or you'd need to determine when DST starts and ends, but since that depends on the exact time zone it will be tricky.

You could use military time zones, which are nice and easy to convert: Alpha (UTC+1) to Mike (UTC+12) (Juliet is skipped), November (UTC-1) to Yankee (UTC-12), and Zulu time zone (UTC+0). Downside: Most civilians don't use them. :) Also there are no names for zones that have an offset of a fraction of an hour.

Show 6 quoted lines
> I'd definitely use a feature like that, and could hack it up on top of
> the current patches if there wasn't vehement opposition to it. Maybe
> the above examples change someone's mind, I can't think of a case
> where someone's relying on %Z now for date-local, or at least cases
> where something like the above wouldn't be more useful in practice
> than just an empty string, but if nobody agrees so be it :)

Personally I don't have a use for time information; dates alone would suffice for me -- so I certainly won't hold you back. But I don't see how it could be done.

René
Previous: Linus TorvaldsNext: Ævar Arnfjörð Bjarmason
Message 30 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.