{"thread":{"id":"259","subject":"[PATCH] fix git log time display for western timezones","startedAt":"2005-04-23T03:06:27Z","lastAt":"2005-04-23T03:06:27Z","messageCount":1,"participants":["Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"1363","messageId":"Pine.LNX.4.62.0504222300010.26129@localhost.localdomain","threadId":"259","inReplyTo":null,"subject":"[PATCH] fix git log time display for western timezones","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2005-04-23T03:06:27Z","receivedAt":"2005-04-23T03:06:27Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"It appears that the date command doesn't know how to substract time and \nalways adds it.  The time zone fixup has to be done separately otherwise \ntime displayed in a negative time zone is wrong.\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n\nIndex: gitlog.sh\n===================================================================\n--- 2a91836b5814ffacb1fde000dfb1e55457761c88/gitlog.sh  (mode:100755 sha1:53b55be31b38b2ab88434cf1ac0a868700e64525)\n+++ uncommitted/gitlog.sh  (mode:100775)\n@@ -56,8 +56,9 @@\n \n \t\t\t\tdate=(${rest#*> })\n \t\t\t\tsec=${date[0]}; tz=${date[1]}\n-\t\t\t\tdtz=${tz/+/+ }; dtz=${dtz/-/- }\n-\t\t\t\tpdate=\"$(date -Rud \"1970-01-01 UTC + $sec sec $dtz\" 2>/dev/null)\"\n+\t\t\t\tdtz=${tz/+/}\n+\t\t\t\tlsec=$(expr $dtz / 100 \\* 3600 + $dtz % 100 \\* 60 + $sec)\n+\t\t\t\tpdate=\"$(date -Rud \"1970-01-01 UTC + $lsec sec\" 2>/dev/null)\"\n \t\t\t\tif [ \"$pdate\" ]; then\n \t\t\t\t\techo -n $color$key $rest | sed \"s/>.*/> ${pdate/+0000/$tz}/\"\n \t\t\t\t\techo $coldefault\n"}]}