From: Tomi Ollila <tomi.ollila@iki.fi>
To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH 4/4] parse-time-string: fix setting and rounding of seconds
Date: Mon, 02 Mar 2015 22:03:55 +0200 [thread overview]
Message-ID: <m2bnkbnp3o.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <1425318424-27017-4-git-send-email-jani@nikula.org>
On Mon, Mar 02 2015, Jani Nikula <jani@nikula.org> wrote:
> If seconds are not specified in the string to be parsed, they're not
> set according to the reference time (in the no rounding case) nor
> rounded properly (in the rounding up cases). Fix this.
>
> The bug caused searches such as date:10:30..10:30 to match messages
> with date exactly 10:30:00 only, and not in range 10:30:00..10:30:59
> (inclusive) as documented.
>
> Note that date searches referring "noon" or "5pm" will still be
> interpreted as exact to the second.
Although I don't fully understands how these changes do the trick (and I
only looked the context) the changes *look* good, and presumably fix
the problem in question (I could check intermediate output but i am just
lazy).
Tests pass and I don't see why anything could get broken by this so +1
Tomi
> ---
> parse-time-string/parse-time-string.c | 4 ++--
> test/T490-parse-time-string.sh | 1 -
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/parse-time-string/parse-time-string.c b/parse-time-string/parse-time-string.c
> index ccad422b3c8d..1cef47d4b0bd 100644
> --- a/parse-time-string/parse-time-string.c
> +++ b/parse-time-string/parse-time-string.c
> @@ -1081,10 +1081,10 @@ parse_time (struct state *state, char sep,
> return set_user_tz (state, state->delim, v1, v2);
> }
>
> - if (!is_valid_time (v1, v2, v3))
> + if (!is_valid_time (v1, v2, n3 ? v3 : 0))
> return -PARSE_TIME_ERR_INVALIDTIME;
>
> - return set_abs_time (state, v1, v2, n3 ? v3 : 0);
> + return set_abs_time (state, v1, v2, n3 ? (int) v3 : UNSET);
> }
>
> /* strtoul helper that assigns length. */
> diff --git a/test/T490-parse-time-string.sh b/test/T490-parse-time-string.sh
> index 9247bdf89543..6aa9d433bfd4 100755
> --- a/test/T490-parse-time-string.sh
> +++ b/test/T490-parse-time-string.sh
> @@ -79,7 +79,6 @@ ${TEST_DIRECTORY}/parse-time --ref=${REFERENCE} < INPUT > OUTPUT
> test_expect_equal_file INPUT OUTPUT
>
> test_begin_subtest "Second rounding tests"
> -test_subtest_known_broken
> REFERENCE=$(_date Tue Jan 11 12:13:14 +0000 2011)
> cat <<EOF > INPUT
> 9:15 ==> Tue Jan 11 09:15:14 +0000 2011
> --
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
next prev parent reply other threads:[~2015-03-02 20:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-02 17:47 [PATCH 1/4] test: improve the time parsing tests Jani Nikula
2015-03-02 17:47 ` [PATCH 2/4] test: add some more time tests Jani Nikula
2015-03-02 17:47 ` [PATCH 3/4] test: extract and flag second rounding tests as broken Jani Nikula
2015-03-02 17:47 ` [PATCH 4/4] parse-time-string: fix setting and rounding of seconds Jani Nikula
2015-03-02 20:03 ` Tomi Ollila [this message]
2015-03-07 9:27 ` [PATCH 1/4] test: improve the time parsing tests David Bremner
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
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2bnkbnp3o.fsf@guru.guru-group.fi \
--to=tomi.ollila@iki.fi \
--cc=jani@nikula.org \
--cc=notmuch@notmuchmail.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.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
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 read-only IMAP folder(s) and NNTP newsgroup(s).