git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix git log time display for western timezones
@ 2005-04-23  3:06 Nicolas Pitre
  0 siblings, 0 replies; only message in thread
From: Nicolas Pitre @ 2005-04-23  3:06 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

It appears that the date command doesn't know how to substract time and 
always adds it.  The time zone fixup has to be done separately otherwise 
time displayed in a negative time zone is wrong.

Signed-off-by: Nicolas Pitre <nico@cam.org>

Index: gitlog.sh
===================================================================
--- 2a91836b5814ffacb1fde000dfb1e55457761c88/gitlog.sh  (mode:100755 sha1:53b55be31b38b2ab88434cf1ac0a868700e64525)
+++ uncommitted/gitlog.sh  (mode:100775)
@@ -56,8 +56,9 @@
 
 				date=(${rest#*> })
 				sec=${date[0]}; tz=${date[1]}
-				dtz=${tz/+/+ }; dtz=${dtz/-/- }
-				pdate="$(date -Rud "1970-01-01 UTC + $sec sec $dtz" 2>/dev/null)"
+				dtz=${tz/+/}
+				lsec=$(expr $dtz / 100 \* 3600 + $dtz % 100 \* 60 + $sec)
+				pdate="$(date -Rud "1970-01-01 UTC + $lsec sec" 2>/dev/null)"
 				if [ "$pdate" ]; then
 					echo -n $color$key $rest | sed "s/>.*/> ${pdate/+0000/$tz}/"
 					echo $coldefault

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-23  3:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-23  3:06 [PATCH] fix git log time display for western timezones Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).