Thread (10 messages) 10 messages, 4 authors, 2016-06-15

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

flat view

From: Anders Kaseorg <hidden>
Date: 2016-06-15 22:51:21

On Mon, 30 May 2011, Jakub Narebski wrote:
quoted
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help