From: Scott Schmit <i.grok@comcast.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Beat Bolli <bbolli@ewanet.ch>, git@vger.kernel.org
Subject: Re: [PATCH] pretty: Provide a strict ISO8601 date format
Date: Fri, 29 Aug 2014 13:44:39 -0400 [thread overview]
Message-ID: <20140829174439.GA10274@odin.ulthar.us> (raw)
In-Reply-To: <xmqq61hc8bvq.fsf@gitster.dls.corp.google.com>
On Thu, Aug 28, 2014 at 03:53:13PM -0700, Junio C Hamano wrote:
> Beat Bolli writes:
> > + else if (mode == DATE_ISO8601_STRICT)
> > + strbuf_addf(&timebuf, "%04d-%02d-%02dT%02d:%02d:%02d%+03d:%02d",
> > + tm->tm_year + 1900,
> > + tm->tm_mon + 1,
> > + tm->tm_mday,
> > + tm->tm_hour, tm->tm_min, tm->tm_sec,
> > + tz / 100, abs(tz % 100));
>
> Wouldn't this misidentify a zone that is 30 minutes off of GMT,
> i.e. tz == -30? tz/100 would not be negative and "%+03d:" would
> happily show "+00:", no?
No. strbuf_addf uses strbuf_vaddf which uses vsnprintf(3). From man
vsnprintf(3):
> The flag characters
> The character % is followed by zero or more of the following
> flags:
>
> + A sign (+ or -) should always be placed before a number
> produced by a signed conversion. By default a sign is
> used only for negative numbers. A + overrides a space if
> both are used.
Perhaps you misread "%+03d:" as "+%02d:"?
--
Scott Schmit
next prev parent reply other threads:[~2014-08-29 17:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 17:49 [PATCH] pretty: Provide a strict ISO8601 date format Beat Bolli
2014-08-28 22:53 ` Junio C Hamano
2014-08-29 17:44 ` Scott Schmit [this message]
2014-08-29 18:41 ` Junio C Hamano
2014-08-29 20:29 ` Scott Schmit
2014-08-29 20:57 ` Junio C Hamano
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=20140829174439.GA10274@odin.ulthar.us \
--to=i.grok@comcast.net \
--cc=bbolli@ewanet.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).