git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: git <git@vger.kernel.org>
Subject: [COGITO PATCH] value too great for base (error token is "-0800")
Date: Thu, 09 Jun 2005 17:40:30 -0400	[thread overview]
Message-ID: <1118353230.2825.10.camel@dv> (raw)

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


             reply	other threads:[~2005-06-09 21:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-09 21:40 Pavel Roskin [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1118353230.2825.10.camel@dv \
    --to=proski@gnu.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).