git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cg-Xlib: make showdate show timezone
@ 2005-06-12 11:40 Dan Holmsand
  2005-06-12 11:52 ` Petr Baudis
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Holmsand @ 2005-06-12 11:40 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Petr Baudis

[-- 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cg-Xlib: make showdate show timezone
  2005-06-12 11:40 [PATCH] cg-Xlib: make showdate show timezone Dan Holmsand
@ 2005-06-12 11:52 ` Petr Baudis
  2005-06-12 17:37   ` Dan Holmsand
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Baudis @ 2005-06-12 11:52 UTC (permalink / raw)
  To: Dan Holmsand; +Cc: Git Mailing List

Dear diary, on Sun, Jun 12, 2005 at 01:40:57PM CEST, I got a letter
where Dan Holmsand <holmsand@gmail.com> told me that...
> 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>

Thanks, applied. But what's the point of calling date with LANG=C? If
the user wants his locale to get used, why prevent him?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
<Espy> be careful, some twit might quote you out of context..

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cg-Xlib: make showdate show timezone
  2005-06-12 11:52 ` Petr Baudis
@ 2005-06-12 17:37   ` Dan Holmsand
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Holmsand @ 2005-06-12 17:37 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Git Mailing List

Petr Baudis wrote:
> Thanks, applied. But what's the point of calling date with LANG=C? If
> the user wants his locale to get used, why prevent him?

Because otherwise, you won't get an RFC-2822 date (which is what you 
explicitly wanted a couple of days ago, and what we had before).

Also, it would look pretty awkward to have parts of the output localized 
  (the date string), and all other parts not ("author", "date", whatnot).

/dan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-12 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-12 11:40 [PATCH] cg-Xlib: make showdate show timezone Dan Holmsand
2005-06-12 11:52 ` Petr Baudis
2005-06-12 17:37   ` Dan Holmsand

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).