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

Re: [PATCH 3/3] gitk: Allow displaying time zones from author and commit timestamps

From
Anders Kaseorg <andersk@mit.edu>
Date
May 30, 2011, 21:35 UTC
Message-ID
<alpine.DEB.2.02.1105301717520.23145@dr-wily.mit.edu>
In-Reply-To
<201105300829.52619.jnareb@gmail.com>
On Mon, 30 May 2011, Jakub Narebski wrote:
> > > Why not use UTC+N timezone […]?
> 
> I think full specification is UTC+HH:MM or UTC-HH:MM.  GNU date
> understands 'TZ=UTC+09:30 date'.
No, that’s not what the letter code in TZ means.  TZ=EDT+04:00 means that
  • The current time zone is called EDT.
  • The current time zone is at offset -04:00 from UTC.  (Note the sign 
    reversal.)
EDT is displayed as the name of the zone and is not used in any 
calculations; it does not mean we’re taking an offset _from_ EDT.
So it doesn’t make sense to write TZ=UTC±NN:NN for any NN:NN other than 
00:00.  Otherwise libc will happily give you the nonsense that you asked 
for:
  $ TZ=UTC+00:00 date; TZ=UTC+09:30 date
  Mon May 30 21:21:32 UTC 2011
  Mon May 30 11:51:32 UTC 2011
This is why I used “Unknown” instead of “UTC”.

(Oh, my comment should have said “Unknown±NN:NN” instead of “Unknown±NNNN”; the code gets it right.)

If I wanted to do better, I’d need a way to translate UTC offsets to zone names, but I don’t know of a canonical way to do that (there’s not even a unique answer in general).

In Tcl ≥ 8.5, none of this matters because ‘clock format -timezone’ just uses the numerical UTC offset as the zone name. For the fallback code, I can’t do that by manipulating TZ, because the zone name needs to be made of letters.

Anders
Previous: Jakub NarebskiNext: Andreas Schwab
Message 13 of 15 in “gitk: Remove unused $cdate array”
  1. 1/3 gitk: Remove unused $cdate arrayAnders Kaseorg, Jan 19, 2011
  2. 2/3 gitk: Remember time zones from author and commit timestampsAnders Kaseorg, Jan 19, 2011
  3. 3/3 gitk: Allow displaying time zones from author and commit timestampsAnders Kaseorg, Jan 19, 2011
  4. Paul MackerrasMay 29, 2011
  5. Anders KaseorgMay 30, 2011
  6. 3/3 gitk: Allow displaying time zones from author and commit timestampsAnders Kaseorg, May 30, 2011
  7. Andreas SchwabMay 30, 2011
  8. Anders KaseorgMay 30, 2011
  9. 3/3 gitk: Allow displaying time zones from author and commit timestampsAnders Kaseorg, May 30, 2011
  10. Jakub NarebskiMay 30, 2011
  11. Tim GuirgiesMay 30, 2011
  12. Jakub NarebskiMay 30, 2011
  13. Anders KaseorgMay 30, 2011
  14. Andreas SchwabMay 30, 2011
  15. 3/3 gitk: Allow displaying time zones from author and commit timestampsAnders Kaseorg, May 30, 2011

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.