[PATCH] TODO: date range queries - check

Jani Nikula jani at nikula.org
Fri Dec 7 13:27:54 PST 2012


On Fri, 07 Dec 2012, Daniel Kahn Gillmor <dkg at fifthhorseman.net> wrote:
> On 12/07/2012 07:19 AM, David Bremner wrote:
>> For specifying one-ended ranges, I find the current syntax OK-ish. It
>> would be reasonable to formulate a seperate TODO for supporting
>> things like date:2012-12-07
>
> Out of curiosity, how does this syntax interact with timezones?

We don't have this particular syntax yet, but it would seem sensible to
expand that to the range expression date:2012-12-07..2012-12-07, which
is currently supported, and means all the messages from the beginning of
specified date to the end.

> If i send a mail in the wee hours of the 27th from the east coast of the
> US (GMT-0500) and jrollins reads it from the west coast of the US
> (GMT-0800) where it is still the 26th, should our notmuch queries behave
> differently when searching for this message?

I'll answer that question with another question: Do you think date
queries should be interpreted according to the timezone of the sender or
the recipient? I'm inclined to believe the local timezone of the system
the query is run on (typically the recipient's timezone) is the only
answer that makes sense, and my ever pessimist/realist gut feeling is
that any attempts to be more clever about the difference in timezones
than the user will be doomed. For you the message date is the 27th, and
for jrollins it's the 26th. But read on.

> are we tracking the TZ of the Date: header in the database at all?  does
> it make sense to take that into account for these queries?

We don't track it or take it into account. The Date: header is converted
to a time_t value using g_mime_utils_header_decode_date(), and stored
into the database as a timestamp. The date: queries are also converted
to timestamps, using local timezone *unless* a timezone is specified in
the query.

And this is the interesting part: You can specify the timezone in the
query. If jrollins talks about a message you sent him on the 26th, you
can, as you know his timezone, query
date:2012-12-26-0800..2012-12-26-0800 to get all messages on that day in
*his* timezone. Including the one you sent him on *your* 27th.

> 	--dkg, posing questions he has no answers to

At the end of the day, I don't have an answer as to whether or indeed
how the sender's timezone could be taken into account in the
queries. But I hope the above clears up how we handle dates and
timezones now, and perhaps leads you to an answer I don't have!


BR,
Jani.


More information about the notmuch mailing list