1 Return-Path: <sojkam1@fel.cvut.cz>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 8FD7C431FAF
\r
6 for <notmuch@notmuchmail.org>; Wed, 3 Oct 2012 12:02:12 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id QCN6Ngp9vv32 for <notmuch@notmuchmail.org>;
\r
16 Wed, 3 Oct 2012 12:02:11 -0700 (PDT)
\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 750E0431FAE
\r
19 for <notmuch@notmuchmail.org>; Wed, 3 Oct 2012 12:02:11 -0700 (PDT)
\r
20 Received: from localhost (unknown [192.168.200.4])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id 6C8573CFE72;
\r
22 Wed, 3 Oct 2012 21:02:09 +0200 (CEST)
\r
23 X-Virus-Scanned: IMAP AMAVIS
\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])
\r
25 by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,
\r
27 with ESMTP id S15GLUU0j2GK; Wed, 3 Oct 2012 21:02:04 +0200 (CEST)
\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])
\r
29 by max.feld.cvut.cz (Postfix) with ESMTP id ADCF419F2F35;
\r
30 Wed, 3 Oct 2012 21:02:03 +0200 (CEST)
\r
31 Received: from steelpick.2x.cz (rtime.felk.cvut.cz [147.32.86.92])
\r
32 (Authenticated sender: sojkam1)
\r
33 by imap.feld.cvut.cz (Postfix) with ESMTPSA id 33B13660904;
\r
34 Wed, 3 Oct 2012 21:02:02 +0200 (CEST)
\r
35 Received: from wsh by steelpick.2x.cz with local (Exim 4.80)
\r
36 (envelope-from <sojkam1@fel.cvut.cz>)
\r
37 id 1TJUCn-000614-Rb; Wed, 03 Oct 2012 21:02:01 +0200
\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
39 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org,
\r
40 David Bremner <david@tethera.net>
\r
41 Subject: Re: [PATCH v3 2/9] parse-time-string: add a date/time parser to
\r
43 In-Reply-To: <87391vz8zx.fsf@nikula.org>
\r
44 References: <cover.1347484177.git.jani@nikula.org>
\r
45 <89741ec9a9687fca8b30aa1a4877392d355dd3ce.1347484177.git.jani@nikula.org>
\r
46 <8739262u4i.fsf@steelpick.2x.cz> <87391vz8zx.fsf@nikula.org>
\r
47 User-Agent: Notmuch/0.14+23~g9d68aca (http://notmuchmail.org) Emacs/24.2.1
\r
48 (x86_64-pc-linux-gnu)
\r
49 Date: Wed, 03 Oct 2012 21:02:01 +0200
\r
50 Message-ID: <87zk43fkgm.fsf@steelpick.2x.cz>
\r
52 Content-Type: text/plain
\r
53 X-BeenThere: notmuch@notmuchmail.org
\r
54 X-Mailman-Version: 2.1.13
\r
56 List-Id: "Use and development of the notmuch mail system."
\r
57 <notmuch.notmuchmail.org>
\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
61 List-Post: <mailto:notmuch@notmuchmail.org>
\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
65 X-List-Received-Date: Wed, 03 Oct 2012 19:02:12 -0000
\r
67 On Wed, Oct 03 2012, Jani Nikula wrote:
\r
68 > On Tue, 25 Sep 2012, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
\r
71 >> On Wed, Sep 12 2012, Jani Nikula wrote:
\r
72 >>> Add a date/time parser to notmuch, to be used for adding date range
\r
73 >>> query support for notmuch lib later on. Add the parser to a directory
\r
74 >>> of its own to make it independent of the rest of the notmuch code
\r
77 >> First of all, thank you very much for pushing this towards mainline.
\r
78 >> This is definitely one of the features I miss in notmuch most.
\r
80 >> Some comments below.
\r
82 > Thanks for the comments; sorry about the delay in responding.
\r
89 >>> + * parse_time_string() - user friendly date and time parser
\r
90 >>> + * @s: string to parse
\r
91 >>> + * @t: pointer to time_t to store parsed time in
\r
92 >>> + * @now: pointer to time_t containing reference date/time, or NULL
\r
93 >>> + * @round: PARSE_TIME_NO_ROUND, PARSE_TIME_ROUND_DOWN, or
\r
94 >>> + * PARSE_TIME_ROUND_UP
\r
96 >>> + * Parse a date/time string 's' and store the parsed date/time result
\r
99 >>> + * A reference date/time is used for determining the "date/time units"
\r
100 >>> + * (roughly equivalent to struct tm members) not specified by 's'. If
\r
101 >>> + * 'now' is non-NULL, it must contain a pointer to a time_t to be used
\r
102 >>> + * as reference date/time. Otherwise, the current time is used.
\r
104 >>> + * If 's' does not specify a full date/time, the 'round' parameter
\r
105 >>> + * specifies if and how the result should be rounded as follows:
\r
107 >>> + * PARSE_TIME_NO_ROUND: All date/time units that are not specified
\r
108 >>> + * by 's' are set to the corresponding unit derived from the
\r
109 >>> + * reference date/time.
\r
111 >>> + * PARSE_TIME_ROUND_DOWN: All date/time units that are more accurate
\r
112 >>> + * than the most accurate unit specified by 's' are set to the
\r
113 >>> + * smallest valid value for that unit. Rest of the unspecified units
\r
114 >>> + * are set as in PARSE_TIME_NO_ROUND.
\r
116 >>> + * PARSE_TIME_ROUND_UP: All date/time units that are more accurate
\r
117 >>> + * than the most accurate unit specified by 's' are set to the
\r
118 >>> + * smallest valid value for that unit. The most accurate unit
\r
119 >>> + * specified by 's' is incremented by one (and this is rolled over
\r
120 >>> + * to the less accurate units as necessary). Rest of the unspecified
\r
121 >>> + * units are set as in PARSE_TIME_NO_ROUND.
\r
123 >> Why you round down and increase the most accurate unit? If I want to see
\r
124 >> emails that were send yesterday, I do not want to see any email that was
\r
125 >> sent the first second of today. (OK, I know that this is slightly easier
\r
128 > It's easy to agree that yesterday's messages should not include messages
\r
129 > from the first second of today. It's not even too difficult to implement
\r
130 > that. But doing that in this API would feel like rounding 0.6 up and
\r
131 > getting 0.9999... as a result.
\r
133 > I'll look at adding a separate rounding mode to keep the API generic
\r
134 > while better support the sole user of the API.
\r
136 I agree that the operation I want here should not be called rounding.
\r
137 Maybe, you can use a term from set theory: supremum or prehaps maximum
\r
138 (seconds are countable).
\r