{"thread":{"id":"36638","subject":"[PATCH] gitk: Allow displaying time zones from author and commit timestamps","startedAt":"2014-05-12T11:25:58Z","lastAt":"2014-06-15T04:56:37Z","messageCount":2,"participants":["Anders Kaseorg","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"241285","messageId":"alpine.DEB.2.02.1405120722570.44324@all-night-tool.MIT.EDU","threadId":"36638","inReplyTo":null,"subject":"[PATCH] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2014-05-12T11:25:58Z","receivedAt":"2014-05-12T11:25: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---\nRe-sending from 2011:\nhttp://thread.gmane.org/gmane.comp.version-control.git/165286/focus=174786\n\n gitk | 24 +++++++++++++++++++++++-\n 1 file changed, 23 insertions(+), 1 deletion(-)\n\ndiff --git a/gitk b/gitk\nindex 90764e8..b4712cd 100755\n--- a/gitk\n+++ b/gitk\n@@ -11575,7 +11575,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-- \n2.0.0.rc3\n"},{"id":"244202","messageId":"20140615045637.GC21978@iris.ozlabs.ibm.com","threadId":"36638","inReplyTo":"alpine.DEB.2.02.1405120722570.44324@all-night-tool.MIT.EDU","subject":"Re: [PATCH] gitk: Allow displaying time zones from author and commit timestamps","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2014-06-15T04:56:37Z","receivedAt":"2014-06-15T04:56:37Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Mon, May 12, 2014 at 07:25:58AM -0400, Anders Kaseorg wrote:\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\nThanks, applied.\n\nPaul.\n"}]}