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

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

From
PRPavel Roskin <proski@gnu.org>
Date
Jun 9, 2005, 21:40 UTC
Message-ID
<1118353230.2825.10.camel@dv>
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
Next: Petr Baudis
Message 1 of 2 in “value too great for base (error token is "-0800")”
  1. value too great for base (error token is "-0800")Pavel Roskin, Jun 9, 2005
  2. Petr BaudisJun 10, 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.