git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Holmsand <holmsand@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Petr Baudis <pasky@ucw.cz>
Subject: [PATCH] cg-Xlib: make showdate show timezone
Date: Sun, 12 Jun 2005 13:40:57 +0200	[thread overview]
Message-ID: <42AC1F49.9010808@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

This makes timezones show up again in showdate's default
format. Hopefully, this also makes showdate a little more
portable.

It also speeds things up a little, by avoiding an extra fork.

Signed-off-by: Dan Holmsand <holmsand@gmail.com>
---

[-- Attachment #2: showdate.patch.txt --]
[-- Type: text/plain, Size: 777 bytes --]

 cg-Xlib |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/cg-Xlib b/cg-Xlib
--- a/cg-Xlib
+++ b/cg-Xlib
@@ -68,14 +68,12 @@ showdate () {
 	# bash doesn't like leading zeros
 	[ "${tzhours:1:1}" = 0 ] && tzhours=${2:0:1}${2:2:1}
 	secs=$(($secs + $tzhours * 3600 + $tzmins * 60))
+	[ "$format" ] || format="+%a, %d %b %Y %H:%M:%S $2"
 	if [ "$has_gnudate" ]; then
-		[ "$format" ] || format=-R
-		pdate=$(date -ud "1970-01-01 UTC + $secs sec" "$format")
+		LANG=C date -ud "1970-01-01 UTC + $secs sec" "$format"
 	else
-		[ "$format" ] || format=--
-		pdate=$(date -u -r $secs "$format")
+		LANG=C date -u -r $secs "$format"
 	fi
-	echo "${pdate/+0000/$tz}"
 }
 
 # Usage: tree_timewarp [--no-head-update] DIRECTION_STR ROLLBACK_BOOL BASE BRANCH

             reply	other threads:[~2005-06-12 11:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-12 11:40 Dan Holmsand [this message]
2005-06-12 11:52 ` [PATCH] cg-Xlib: make showdate show timezone Petr Baudis
2005-06-12 17:37   ` Dan Holmsand

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=42AC1F49.9010808@gmail.com \
    --to=holmsand@gmail.com \
    --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).