diff options
author | Jani Nikula <jani@nikula.org> | 2015-03-02 19:47:04 +0200 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2015-03-07 10:20:33 +0100 |
commit | 6aeef2ee15d16a0376f5bad8309a1da99fb73004 (patch) | |
tree | 93462fc0e638d87201f03fd88479da38021af650 /parse-time-string | |
parent | 952f46fedc0d385650e00ad739814a0127e13fa1 (diff) |
parse-time-string: fix setting and rounding of seconds
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.
Diffstat (limited to 'parse-time-string')
-rw-r--r-- | parse-time-string/parse-time-string.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/parse-time-string/parse-time-string.c b/parse-time-string/parse-time-string.c index ccad422b..1cef47d4 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. */ |