git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nico@cam.org>
To: Petr Baudis <pasky@ucw.cz>
Cc: git@vger.kernel.org
Subject: [PATCH] fix git log time display for western timezones
Date: Fri, 22 Apr 2005 23:06:27 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.62.0504222300010.26129@localhost.localdomain> (raw)

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

                 reply	other threads:[~2005-04-23  3:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.62.0504222300010.26129@localhost.localdomain \
    --to=nico@cam.org \
    --cc=git@vger.kernel.org \
    --cc=pasky@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).