git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] cg-Xlib: make showdate show timezone

From
Dan Holmsand <holmsand@gmail.com>
Date
Jun 12, 2005, 11:40 UTC
Message-ID
<42AC1F49.9010808@gmail.com>

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>
---
 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
Next: Petr Baudis
Message 1 of 3 in “cg-Xlib: make showdate show timezone”
  1. cg-Xlib: make showdate show timezoneDan Holmsand, Jun 12, 2005
  2. Petr BaudisJun 12, 2005
  3. Dan HolmsandJun 12, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.