{"thread":{"id":"26309","subject":"[PATCH 1/3] gitk: Remove unused $cdate array","startedAt":"2011-01-19T19:46:59Z","lastAt":"2011-05-30T22:41:50Z","messageCount":15,"participants":["Anders Kaseorg","Paul Mackerras","Jakub Narebski","Tim Guirgies","Andreas Schwab"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"159664","messageId":"alpine.DEB.2.02.1101191445130.23868@dr-wily.mit.edu","threadId":"26309","inReplyTo":null,"subject":"[PATCH 1/3] gitk: Remove unused $cdate array","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2011-01-19T19:46:59Z","receivedAt":"2011-01-19T19:46:59Z","isPatch":true,"sender":{"key":"andersk@mit.edu","avatar":"https://avatars.githubusercontent.com/u/26471?v=4"},"body":"It was unused since commit 9f1afe05c3ab7228e21ba3666c6e35d693149b37.\n\nSigned-off-by: Anders Kaseorg <andersk@mit.edu>\n---\n gitk |    5 +----\n 1 files changed, 1 insertions(+), 4 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex a0f7816..bf68959 100755\n--- a/gitk\n+++ b/gitk\n@@ -1621,7 +1621,7 @@ proc readcommit {id} {\n }\n \n proc parsecommit {id contents listed} {\n-    global commitinfo cdate\n+    global commitinfo\n \n     set inhdr 1\n     set comment {}\n@@ -1671,9 +1671,6 @@ proc parsecommit {id contents listed} {\n \t}\n \tset comment $newcomment\n     }\n-    if {$comdate != {}} {\n-\tset cdate($id) $comdate\n-    }\n     set commitinfo($id) [list $headline $auname $audate \\\n \t\t\t     $comname $comdate $comment]\n }\n-- \n1.7.4.rc1\n"},{"id":"159665","messageId":"alpine.DEB.2.02.1101191447040.23868@dr-wily.mit.edu","threadId":"26309","inReplyTo":"alpine.DEB.2.02.1101191445130.23868@dr-wily.mit.edu","subject":"[PATCH 2/3] gitk: Remember time zones from author and commit timestamps","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2011-01-19T19:47:25Z","receivedAt":"2011-01-19T19:47:25Z","isPatch":true,"sender":{"key":"andersk@mit.edu","avatar":"https://avatars.githubusercontent.com/u/26471?v=4"},"body":"When resolving a conflicted cherry-pick, this lets us pass\nGIT_AUTHOR_DATE to git citool with the correct timezone.\n\nSigned-off-by: Anders Kaseorg <andersk@mit.edu>\n---\n gitk |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex bf68959..5c6058a 100755\n--- a/gitk\n+++ b/gitk\n@@ -659,7 +659,7 @@ proc newvarc {view id} {\n \tif {![info exists commitinfo($id)]} {\n \t    parsecommit $id $commitdata($id) 1\n \t}\n-\tset cdate [lindex $commitinfo($id) 4]\n+\tset cdate [lindex [lindex $commitinfo($id) 4] 0]\n \tif {![string is integer -strict $cdate]} {\n \t    set cdate 0\n \t}\n@@ -1641,10 +1641,10 @@ proc parsecommit {id contents listed} {\n \tset line [split $line \" \"]\n \tset tag [lindex $line 0]\n \tif {$tag == \"author\"} {\n-\t    set audate [lindex $line end-1]\n+\t    set audate [lrange $line end-1 end]\n \t    set auname [join [lrange $line 1 end-2] \" \"]\n \t} elseif {$tag == \"committer\"} {\n-\t    set comdate [lindex $line end-1]\n+\t    set comdate [lrange $line end-1 end]\n \t    set comname [join [lrange $line 1 end-2] \" \"]\n \t}\n     }\n@@ -11018,7 +11018,7 @@ proc prefsok {} {\n proc formatdate {d} {\n     global datetimeformat\n     if {$d ne {}} {\n-\tset d [clock format $d -format $datetimeformat]\n+\tset d [clock format [lindex $d 0] -format $datetimeformat]\n     }\n     return $d\n }\n-- \n1.7.4.rc1\n"},{"id":"159666","messageId":"alpine.DEB.2.02.1101191447340.23868@dr-wily.mit.edu","threadId":"26309","inReplyTo":"alpine.DEB.2.02.1101191445130.23868@dr-wily.mit.edu","subject":"[PATCH 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2011-01-19T19:47:52Z","receivedAt":"2011-01-19T19:47:52Z","isPatch":true,"sender":{"key":"andersk@mit.edu","avatar":"https://avatars.githubusercontent.com/u/26471?v=4"},"body":"Now gitk can be configured to display author and commit dates in their\noriginal timezone, by putting %z into datetimeformat in ~/.gitk.\n\nSigned-off-by: Anders Kaseorg <andersk@mit.edu>\n---\n gitk |   13 ++++++++++++-\n 1 files changed, 12 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 5c6058a..a072593 100755\n--- a/gitk\n+++ b/gitk\n@@ -11018,7 +11018,18 @@ proc prefsok {} {\n proc formatdate {d} {\n     global datetimeformat\n     if {$d ne {}} {\n-\tset d [clock format [lindex $d 0] -format $datetimeformat]\n+\tif {[string match {*%[zZ]*} $datetimeformat]} {\n+\t    if {[catch {set d [clock format [lindex $d 0] -timezone [lindex $d 1] -format $datetimeformat]}]} {\n+\t\t# Tcl < 8.5 does not support -timezone.\n+\t\tglobal env\n+\t\tset zone [lindex $d 1]\n+\t\tset env(TZ) \"IDK[string range $zone 0 2]:[string range $zone 3 end]\"\n+\t\tset d [clock format [lindex $d 0] -format $datetimeformat]\n+\t\tunset env(TZ)\n+\t    }\n+\t} else {\n+\t    set d [clock format [lindex $d 0] -format $datetimeformat]\n+\t}\n     }\n     return $d\n }\n-- \n1.7.4.rc1\n"},{"id":"168937","messageId":"20110529044656.GA8881@brick.ozlabs.ibm.com","threadId":"26309","inReplyTo":"alpine.DEB.2.02.1101191447340.23868@dr-wily.mit.edu","subject":"Re: [PATCH 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2011-05-29T04:46:56Z","receivedAt":"2011-05-29T04:46:56Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Wed, Jan 19, 2011 at 02:47:52PM -0500, Anders Kaseorg wrote:\n\n> Now gitk can be configured to display author and commit dates in their\n> original timezone, by putting %z into datetimeformat in ~/.gitk.\n> \n> Signed-off-by: Anders Kaseorg <andersk@mit.edu>\n> ---\n>  gitk |   13 ++++++++++++-\n>  1 files changed, 12 insertions(+), 1 deletions(-)\n> \n> diff --git a/gitk b/gitk\n> index 5c6058a..a072593 100755\n> --- a/gitk\n> +++ b/gitk\n> @@ -11018,7 +11018,18 @@ proc prefsok {} {\n>  proc formatdate {d} {\n>      global datetimeformat\n>      if {$d ne {}} {\n> -\tset d [clock format [lindex $d 0] -format $datetimeformat]\n> +\tif {[string match {*%[zZ]*} $datetimeformat]} {\n> +\t    if {[catch {set d [clock format [lindex $d 0] -timezone [lindex $d 1] -format $datetimeformat]}]} {\n> +\t\t# Tcl < 8.5 does not support -timezone.\n> +\t\tglobal env\n> +\t\tset zone [lindex $d 1]\n> +\t\tset env(TZ) \"IDK[string range $zone 0 2]:[string range $zone 3 end]\"\n\nWhat is this about?  Where is the IDK prefix for timezones defined or\ndescribed?\n\n> +\t\tset d [clock format [lindex $d 0] -format $datetimeformat]\n> +\t\tunset env(TZ)\n\nOops, we just lost any previous setting of TZ...\n\nPaul.\n"},{"id":"168962","messageId":"alpine.DEB.2.02.1105291740410.23145@dr-wily.mit.edu","threadId":"26309","inReplyTo":"20110529044656.GA8881@brick.ozlabs.ibm.com","subject":"Re: [PATCH 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2011-05-30T03:05:29Z","receivedAt":"2011-05-30T03:05:29Z","isPatch":true,"sender":{"key":"andersk@mit.edu","avatar":"https://avatars.githubusercontent.com/u/26471?v=4"},"body":"On Sun, 29 May 2011, Paul Mackerras wrote:\n> > @@ -11018,7 +11018,18 @@ proc prefsok {} {\n> >  proc formatdate {d} {\n> >      global datetimeformat\n> >      if {$d ne {}} {\n> > -\tset d [clock format [lindex $d 0] -format $datetimeformat]\n> > +\tif {[string match {*%[zZ]*} $datetimeformat]} {\n> > +\t    if {[catch {set d [clock format [lindex $d 0] -timezone [lindex $d 1] -format $datetimeformat]}]} {\n> > +\t\t# Tcl < 8.5 does not support -timezone.\n> > +\t\tglobal env\n> > +\t\tset zone [lindex $d 1]\n> > +\t\tset env(TZ) \"IDK[string range $zone 0 2]:[string range $zone 3 end]\"\n> \n> What is this about?  Where is the IDK prefix for timezones defined or\n> described?\n\nYeah, sorry, that deserved a bit more explanation.  This is a kludge to \nget Tcl 8.4 to format dates in the right timezone.  IDK is an arbitrary \nmade up 3-letter code (“I Don’t Know”), since a UTC offset can’t generally \nbe converted into a zone name.  The format of TZ is described at:\nhttp://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html\nhttp://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html\n\nActually, reading that again, I just realized that I need to invert the \nsign.  Also that it can be longer than 3 letters; I’ll use “Unknown” \ninstead.\n\n> > +\t\tset d [clock format [lindex $d 0] -format $datetimeformat]\n> > +\t\tunset env(TZ)\n> \n> Oops, we just lost any previous setting of TZ...\n\nGood point.\n\nThanks for taking a look.  I’ll follow up with a fixed version.\n\nAnders\n"},{"id":"168963","messageId":"alpine.DEB.2.02.1105292305390.23145@dr-wily.mit.edu","threadId":"26309","inReplyTo":"alpine.DEB.2.02.1105291740410.23145@dr-wily.mit.edu","subject":"[PATCH v2 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2011-05-30T03:06:34Z","receivedAt":"2011-05-30T03:06:34Z","isPatch":true,"sender":{"key":"andersk@mit.edu","avatar":"https://avatars.githubusercontent.com/u/26471?v=4"},"body":"Now gitk can be configured to display author and commit dates in their\noriginal timezone, by putting %z into datetimeformat in ~/.gitk.\n\nSigned-off-by: Anders Kaseorg <andersk@mit.edu>\n---\n gitk |   18 +++++++++++++++++-\n 1 files changed, 17 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 8e15572..c77771e 100755\n--- a/gitk\n+++ b/gitk\n@@ -11021,7 +11021,23 @@ proc prefsok {} {\n proc formatdate {d} {\n     global datetimeformat\n     if {$d ne {}} {\n-\tset d [clock format [lindex $d 0] -format $datetimeformat]\n+\t# If $datetimeformat includes a timezone, display in the\n+\t# timezone of the argument.  Otherwise, display in local time.\n+\tif {[string match {*%[zZ]*} $datetimeformat]} {\n+\t    if {[catch {set d [clock format [lindex $d 0] -timezone [lindex $d 1] -format $datetimeformat]}]} {\n+\t\t# Tcl < 8.5 does not support -timezone.  Emulate it by\n+\t\t# setting TZ=Unknown±NNNN.\n+\t\tglobal env\n+\t\tcatch {set savedTZ $env(TZ)}\n+\t\tset zone [lindex $d 1]\n+\t\tset sign [string map {+ - - +} [string index $zone 0]]\n+\t\tset env(TZ) Unknown$sign[string range $zone 1 2]:[string range $zone 3 4]\n+\t\tset d [clock format [lindex $d 0] -format $datetimeformat]\n+\t\tif {[catch {set env(TZ) $savedTZ}]} {unset env(TZ)}\n+\t    }\n+\t} else {\n+\t    set d [clock format [lindex $d 0] -format $datetimeformat]\n+\t}\n     }\n     return $d\n }\n-- \n1.7.5.3\n"},{"id":"168971","messageId":"m3mxi4yco5.fsf@localhost.localdomain","threadId":"26309","inReplyTo":"alpine.DEB.2.02.1105291740410.23145@dr-wily.mit.edu","subject":"Re: [PATCH 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-05-30T05:35:08Z","receivedAt":"2011-05-30T05:35:08Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Anders Kaseorg <andersk@MIT.EDU> writes:\n> On Sun, 29 May 2011, Paul Mackerras wrote:\n\n> > > @@ -11018,7 +11018,18 @@ proc prefsok {} {\n> > >  proc formatdate {d} {\n> > >      global datetimeformat\n> > >      if {$d ne {}} {\n> > > -\tset d [clock format [lindex $d 0] -format $datetimeformat]\n> > > +\tif {[string match {*%[zZ]*} $datetimeformat]} {\n> > > +\t    if {[catch {set d [clock format [lindex $d 0] -timezone [lindex $d 1] -format $datetimeformat]}]} {\n> > > +\t\t# Tcl < 8.5 does not support -timezone.\n> > > +\t\tglobal env\n> > > +\t\tset zone [lindex $d 1]\n> > > +\t\tset env(TZ) \"IDK[string range $zone 0 2]:[string range $zone 3 end]\"\n> > \n> > What is this about?  Where is the IDK prefix for timezones defined or\n> > described?\n> \n> Yeah, sorry, that deserved a bit more explanation.  This is a kludge to \n> get Tcl 8.4 to format dates in the right timezone.  IDK is an arbitrary \n> made up 3-letter code (“I Don’t Know”), since a UTC offset can’t generally \n> be converted into a zone name.  The format of TZ is described at:\n> http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html\n> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html\n> \n> Actually, reading that again, I just realized that I need to invert the \n> sign.  Also that it can be longer than 3 letters; I’ll use “Unknown” \n> instead.\n\nWhy not use UTC+N timezone (note: please check of for +HHMM it is\nUTC+HH or UTC-HH) for timezone with given numeric offset from\nCoordinated Universal Time?\n\nBTW. UTC because http://www.nist.gov/pml/div688/utcnist.cfm#cut\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"168973","messageId":"20110530061757.GC3723@Imperial-SD-Longsword","threadId":"26309","inReplyTo":"m3mxi4yco5.fsf@localhost.localdomain","subject":"Re: [PATCH 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Tim Guirgies","fromEmail":"lt.infiltrator@gmail.com","sentAt":"2011-05-30T06:17:58Z","receivedAt":"2011-05-30T06:17:58Z","isPatch":true,"sender":{"key":"lt.infiltrator@gmail.com","avatar":null},"body":"On Sun, May 29, 2011 at 10:35:08PM -0700, Jakub Narebski wrote:\n> Anders Kaseorg <andersk@MIT.EDU> writes:\n> > On Sun, 29 May 2011, Paul Mackerras wrote:\n> \n> > > > @@ -11018,7 +11018,18 @@ proc prefsok {} {\n> > > >  proc formatdate {d} {\n> > > >      global datetimeformat\n> > > >      if {$d ne {}} {\n> > > > -\tset d [clock format [lindex $d 0] -format $datetimeformat]\n> > > > +\tif {[string match {*%[zZ]*} $datetimeformat]} {\n> > > > +\t    if {[catch {set d [clock format [lindex $d 0] -timezone [lindex $d 1] -format $datetimeformat]}]} {\n> > > > +\t\t# Tcl < 8.5 does not support -timezone.\n> > > > +\t\tglobal env\n> > > > +\t\tset zone [lindex $d 1]\n> > > > +\t\tset env(TZ) \"IDK[string range $zone 0 2]:[string range $zone 3 end]\"\n> > > \n> > > What is this about?  Where is the IDK prefix for timezones defined or\n> > > described?\n> > \n> > Yeah, sorry, that deserved a bit more explanation.  This is a kludge to \n> > get Tcl 8.4 to format dates in the right timezone.  IDK is an arbitrary \n> > made up 3-letter code (“I Don’t Know”), since a UTC offset can’t generally \n> > be converted into a zone name.  The format of TZ is described at:\n> > http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html\n> > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html\n> > \n> > Actually, reading that again, I just realized that I need to invert the \n> > sign.  Also that it can be longer than 3 letters; I’ll use “Unknown” \n> > instead.\n> \n> Why not use UTC+N timezone (note: please check of for +HHMM it is\n> UTC+HH or UTC-HH) for timezone with given numeric offset from\n> Coordinated Universal Time?\n> \n> BTW. UTC because http://www.nist.gov/pml/div688/utcnist.cfm#cut\n\nBut what of half-hour offsets, in that case?  A better idea would be\nUTC+HHMM or UTC-HHMM.  As an example, SA (CST) has a timezone of\nUTC+0930.\n\n\nTim\n\n-- \nlt.infiltrator@gmail.com\n\n() ascii ribbon campaign - against html e-mail\n/\\ www.asciiribbon.org   - against proprietary attachments\n"},{"id":"168974","messageId":"201105300829.52619.jnareb@gmail.com","threadId":"26309","inReplyTo":"20110530061757.GC3723@Imperial-SD-Longsword","subject":"Re: [PATCH 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-05-30T06:29:51Z","receivedAt":"2011-05-30T06:29:51Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Tim Guirgies wrote:\n> On Sun, May 29, 2011 at 10:35:08PM -0700, Jakub Narebski wrote:\n> > Anders Kaseorg <andersk@MIT.EDU> writes:\n\n[...]\n> > > Yeah, sorry, that deserved a bit more explanation.  This is a kludge to \n> > > get Tcl 8.4 to format dates in the right timezone.  IDK is an arbitrary \n> > > made up 3-letter code (“I Don’t Know”), since a UTC offset can’t generally \n> > > be converted into a zone name.  The format of TZ is described at:\n> > > http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html\n> > > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html\n> > > \n> > > Actually, reading that again, I just realized that I need to invert the \n> > > sign.  Also that it can be longer than 3 letters; I’ll use “Unknown” \n> > > instead.\n> > \n> > Why not use UTC+N timezone (note: please check of for +HHMM it is\n> > UTC+HH or UTC-HH) for timezone with given numeric offset from\n> > Coordinated Universal Time?\n> > \n> > BTW. UTC because http://www.nist.gov/pml/div688/utcnist.cfm#cut\n> \n> But what of half-hour offsets, in that case?  A better idea would be\n> UTC+HHMM or UTC-HHMM.  As an example, SA (CST) has a timezone of\n> UTC+0930.\n\nI think full specification is UTC+HH:MM or UTC-HH:MM.  GNU date\nunderstands 'TZ=UTC+09:30 date'.\n\n\nP.S. I should have remembered about fractional timezones, as we have had\nproblems in gitweb with those... and I have checked then that git.git\nrepository includes some commits in fractional timezones.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"169019","messageId":"m2sjrw9e21.fsf@igel.home","threadId":"26309","inReplyTo":"alpine.DEB.2.02.1105292305390.23145@dr-wily.mit.edu","subject":"Re: [PATCH v2 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-05-30T19:35:50Z","receivedAt":"2011-05-30T19:35:50Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Anders Kaseorg <andersk@MIT.EDU> writes:\n\n> +\t\tcatch {set savedTZ $env(TZ)}\n                if {[info exits env(TZ)]} {set savedTZ $env(TZ)}\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"169028","messageId":"alpine.DEB.2.02.1105301717520.23145@dr-wily.mit.edu","threadId":"26309","inReplyTo":"201105300829.52619.jnareb@gmail.com","subject":"Re: [PATCH 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2011-05-30T21:35:55Z","receivedAt":"2011-05-30T21:35:55Z","isPatch":true,"sender":{"key":"andersk@mit.edu","avatar":"https://avatars.githubusercontent.com/u/26471?v=4"},"body":"On Mon, 30 May 2011, Jakub Narebski wrote:\n> > > Why not use UTC+N timezone […]?\n> \n> I think full specification is UTC+HH:MM or UTC-HH:MM.  GNU date\n> understands 'TZ=UTC+09:30 date'.\n\nNo, that’s not what the letter code in TZ means.  TZ=EDT+04:00 means that\n  • The current time zone is called EDT.\n  • The current time zone is at offset -04:00 from UTC.  (Note the sign \n    reversal.)\nEDT is displayed as the name of the zone and is not used in any \ncalculations; it does not mean we’re taking an offset _from_ EDT.\n\nSo it doesn’t make sense to write TZ=UTC±NN:NN for any NN:NN other than \n00:00.  Otherwise libc will happily give you the nonsense that you asked \nfor:\n  $ TZ=UTC+00:00 date; TZ=UTC+09:30 date\n  Mon May 30 21:21:32 UTC 2011\n  Mon May 30 11:51:32 UTC 2011\n\nThis is why I used “Unknown” instead of “UTC”.\n\n(Oh, my comment should have said “Unknown±NN:NN” instead of \n“Unknown±NNNN”; the code gets it right.)\n\nIf I wanted to do better, I’d need a way to translate UTC offsets to zone \nnames, but I don’t know of a canonical way to do that (there’s not even a \nunique answer in general).\n\nIn Tcl ≥ 8.5, none of this matters because ‘clock format -timezone’ just \nuses the numerical UTC offset as the zone name.  For the fallback code, I \ncan’t do that by manipulating TZ, because the zone name needs to be made \nof letters.\n\nAnders\n"},{"id":"169029","messageId":"alpine.DEB.2.02.1105301739290.23145@dr-wily.mit.edu","threadId":"26309","inReplyTo":"m2sjrw9e21.fsf@igel.home","subject":"Re: [PATCH v2 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2011-05-30T21:45:40Z","receivedAt":"2011-05-30T21:45:40Z","isPatch":true,"sender":{"key":"andersk@mit.edu","avatar":"https://avatars.githubusercontent.com/u/26471?v=4"},"body":"On Mon, 30 May 2011, Andreas Schwab wrote:\n> > +\t\tcatch {set savedTZ $env(TZ)}\n>                 if {[info exits env(TZ)]} {set savedTZ $env(TZ)}\n\nThat felt like a lot of noise just to save and restore an environment \nvariable, but since I more or less learned Tcl just to write this patch, \nI’ll defer to your judgement of style here.\n\nThanks,\nAnders\n\n\ndiff --git a/gitk b/gitk\nindex c77771e..6a4c8ed 100755\n--- a/gitk\n+++ b/gitk\n@@ -11026,14 +11026,20 @@ proc formatdate {d} {\n \tif {[string match {*%[zZ]*} $datetimeformat]} {\n \t    if {[catch {set d [clock format [lindex $d 0] -timezone [lindex $d 1] -format $datetimeformat]}]} {\n \t\t# Tcl < 8.5 does not support -timezone.  Emulate it by\n-\t\t# setting TZ=Unknown±NNNN.\n+\t\t# setting TZ=Unknown±NN:NN.\n \t\tglobal env\n-\t\tcatch {set savedTZ $env(TZ)}\n+\t\tif {[info exists env(TZ)]} {\n+\t\t    set savedTZ $env(TZ)\n+\t\t}\n \t\tset zone [lindex $d 1]\n \t\tset sign [string map {+ - - +} [string index $zone 0]]\n \t\tset env(TZ) Unknown$sign[string range $zone 1 2]:[string range $zone 3 4]\n \t\tset d [clock format [lindex $d 0] -format $datetimeformat]\n-\t\tif {[catch {set env(TZ) $savedTZ}]} {unset env(TZ)}\n+\t\tif {[info exists savedTZ]} {\n+\t\t    set env(TZ) $savedTZ\n+\t\t} else {\n+\t\t    unset env(TZ)\n+\t\t}\n \t    }\n \t} else {\n \t    set d [clock format [lindex $d 0] -format $datetimeformat]\n"},{"id":"169030","messageId":"alpine.DEB.2.02.1105301745580.23145@dr-wily.mit.edu","threadId":"26309","inReplyTo":"alpine.DEB.2.02.1105301739290.23145@dr-wily.mit.edu","subject":"[PATCH v3 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2011-05-30T21:47:58Z","receivedAt":"2011-05-30T21:47:58Z","isPatch":true,"sender":{"key":"andersk@mit.edu","avatar":"https://avatars.githubusercontent.com/u/26471?v=4"},"body":"Now gitk can be configured to display author and commit dates in their\noriginal timezone, by putting %z into datetimeformat in ~/.gitk.\n\nSigned-off-by: Anders Kaseorg <andersk@mit.edu>\n---\n gitk |   24 +++++++++++++++++++++++-\n 1 files changed, 23 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 8e15572..6a4c8ed 100755\n--- a/gitk\n+++ b/gitk\n@@ -11021,7 +11021,29 @@ proc prefsok {} {\n proc formatdate {d} {\n     global datetimeformat\n     if {$d ne {}} {\n-\tset d [clock format [lindex $d 0] -format $datetimeformat]\n+\t# If $datetimeformat includes a timezone, display in the\n+\t# timezone of the argument.  Otherwise, display in local time.\n+\tif {[string match {*%[zZ]*} $datetimeformat]} {\n+\t    if {[catch {set d [clock format [lindex $d 0] -timezone [lindex $d 1] -format $datetimeformat]}]} {\n+\t\t# Tcl < 8.5 does not support -timezone.  Emulate it by\n+\t\t# setting TZ=Unknown±NN:NN.\n+\t\tglobal env\n+\t\tif {[info exists env(TZ)]} {\n+\t\t    set savedTZ $env(TZ)\n+\t\t}\n+\t\tset zone [lindex $d 1]\n+\t\tset sign [string map {+ - - +} [string index $zone 0]]\n+\t\tset env(TZ) Unknown$sign[string range $zone 1 2]:[string range $zone 3 4]\n+\t\tset d [clock format [lindex $d 0] -format $datetimeformat]\n+\t\tif {[info exists savedTZ]} {\n+\t\t    set env(TZ) $savedTZ\n+\t\t} else {\n+\t\t    unset env(TZ)\n+\t\t}\n+\t    }\n+\t} else {\n+\t    set d [clock format [lindex $d 0] -format $datetimeformat]\n+\t}\n     }\n     return $d\n }\n-- \n1.7.5.3\n"},{"id":"169034","messageId":"m21uzfal5i.fsf@igel.home","threadId":"26309","inReplyTo":"alpine.DEB.2.02.1105301717520.23145@dr-wily.mit.edu","subject":"Re: [PATCH 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-05-30T22:17:13Z","receivedAt":"2011-05-30T22:17:13Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Anders Kaseorg <andersk@MIT.EDU> writes:\n\n> In Tcl ≥ 8.5, none of this matters because ‘clock format -timezone’ just \n> uses the numerical UTC offset as the zone name.  For the fallback code, I \n> can’t do that by manipulating TZ, because the zone name needs to be made \n> of letters.\n\nPOSIX defines the form TZ=\"<-0430>+04:30\" where <...> can contain any\ncharacter from [a-zA-Z0-9+-].\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"169035","messageId":"alpine.DEB.2.02.1105301838300.23145@dr-wily.mit.edu","threadId":"26309","inReplyTo":"m21uzfal5i.fsf@igel.home","subject":"[PATCH v4 3/3] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2011-05-30T22:41:50Z","receivedAt":"2011-05-30T22:41:50Z","isPatch":true,"sender":{"key":"andersk@mit.edu","avatar":"https://avatars.githubusercontent.com/u/26471?v=4"},"body":"Now gitk can be configured to display author and commit dates in their\noriginal timezone, by putting %z into datetimeformat in ~/.gitk.\n\nSigned-off-by: Anders Kaseorg <andersk@mit.edu>\n---\nOn Tue, 31 May 2011, Andreas Schwab wrote:\n> POSIX defines the form TZ=\"<-0430>+04:30\" where <...> can contain any\n> character from [a-zA-Z0-9+-].\n\nOh hey, it does!  Let’s use that then.\n\nAnders\n\n gitk |   24 +++++++++++++++++++++++-\n 1 files changed, 23 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 8e15572..ca3aa54 100755\n--- a/gitk\n+++ b/gitk\n@@ -11021,7 +11021,29 @@ proc prefsok {} {\n proc formatdate {d} {\n     global datetimeformat\n     if {$d ne {}} {\n-\tset d [clock format [lindex $d 0] -format $datetimeformat]\n+\t# If $datetimeformat includes a timezone, display in the\n+\t# timezone of the argument.  Otherwise, display in local time.\n+\tif {[string match {*%[zZ]*} $datetimeformat]} {\n+\t    if {[catch {set d [clock format [lindex $d 0] -timezone [lindex $d 1] -format $datetimeformat]}]} {\n+\t\t# Tcl < 8.5 does not support -timezone.  Emulate it by\n+\t\t# setting TZ (e.g. TZ=<-0430>+04:30).\n+\t\tglobal env\n+\t\tif {[info exists env(TZ)]} {\n+\t\t    set savedTZ $env(TZ)\n+\t\t}\n+\t\tset zone [lindex $d 1]\n+\t\tset sign [string map {+ - - +} [string index $zone 0]]\n+\t\tset env(TZ) <$zone>$sign[string range $zone 1 2]:[string range $zone 3 4]\n+\t\tset d [clock format [lindex $d 0] -format $datetimeformat]\n+\t\tif {[info exists savedTZ]} {\n+\t\t    set env(TZ) $savedTZ\n+\t\t} else {\n+\t\t    unset env(TZ)\n+\t\t}\n+\t    }\n+\t} else {\n+\t    set d [clock format [lindex $d 0] -format $datetimeformat]\n+\t}\n     }\n     return $d\n }\n-- \n1.7.5.3\n"}]}