[COGITO PATCH] value too great for base (error token is "-0800")

From: Pavel Roskin <proski@gnu.org>
Date: 2005-06-10 07:40:30
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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Fri Jun 10 07:41:00 2005

This archive was generated by hypermail 2.1.8 : 2005-06-10 07:41:00 EST