git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [COGITO PATCH] value too great for base (error token is "-0800")
@ 2005-06-09 21:40 Pavel Roskin
  2005-06-09 11:19 ` [PATCH 3/6] Make showdate use "Linus format" Dan Holmsand
  0 siblings, 1 reply; 13+ messages in thread
From: Pavel Roskin @ 2005-06-09 21:40 UTC (permalink / raw)
  To: git

Hello!

The current cogito has problems with timezones that are too far from the
Greenwich meridian :-)

Bash interprets numbers beginning with 0 as octals.  Therefore, we need
to strip leading zeroes or zeroes following "-".  But if we get too
zealous and strip all digits, we'll need to restore one 0.  I tried to
write for sed portably, so I avoided some optimizations, such as
s/^-\?$/0/

Signed-off-by: Pavel Roskin <proski@gnu.org>

diff --git a/cg-Xlib b/cg-Xlib
--- a/cg-Xlib
+++ b/cg-Xlib
@@ -65,7 +65,7 @@ showdate () {
 	[ "$format" ] || format=-R
 	sec=${date[0]}; tz=${date[1]}
 	if [ "$has_gnudate" ]; then
-	        dtz=${tz/+/}
+	        dtz=$(echo $tz | sed 's/^+//;s/^0*//;s/^-0*/-/;s/^$/0/;s/^-$/0/')
 		lsec=$(($dtz / 100 * 3600 + $dtz % 100 * 60 + $sec))
 	        pdate="$(date -ud "1970-01-01 UTC + $lsec sec" "$format" 2>/dev/null)"
 	else

-- 
Regards,
Pavel Roskin


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

end of thread, other threads:[~2005-06-11  8:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-09 21:40 [COGITO PATCH] value too great for base (error token is "-0800") Pavel Roskin
2005-06-09 11:19 ` [PATCH 3/6] Make showdate use "Linus format" Dan Holmsand
2005-06-09  9:19   ` [ANNOUNCE] Cogito-0.11.3 Petr Baudis
2005-06-09 10:10     ` Konstantin Antselovich
2005-06-09 13:07       ` Dan Holmsand
2005-06-09 20:55         ` Chris Wright
2005-06-09 21:06           ` Chris Wright
2005-06-09  3:40             ` [PATCH] Fix cogito handling of timezones Frank Sorenson
2005-06-09  8:29               ` Petr Baudis
2005-06-09 14:20                 ` Frank Sorenson
2005-06-10 22:19               ` Petr Baudis
2005-06-10 22:59   ` [PATCH 3/6] Make showdate use "Linus format" Petr Baudis
2005-06-11  8:28     ` 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).