On Sun, Jun 19, 2011 at 5:45 AM, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote: > Hi Sebastian, Patrick. > > On Sat, 18 Jun 2011 12:30:01 +0200, Sebastian Spaeth <Sebastian@SSpaeth.de> wrote: >> On Fri, 17 Jun 2011 17:10:24 +0100, Patrick Totzke : >> > #0 0x006eb87d in Xapian::Document::Internal::get_value(unsigned int) const () from /usr/lib/sse2/libxapian.so.22 >> > #1 0x006eb952 in Xapian::Document::get_value(unsigned int) const () from /usr/lib/sse2/libxapian.so.22 >> > #2 0x00523963 in notmuch_message_get_date () from /usr/local/lib/libnotmuch.so.1 >> >> One question, what type is libnotmuch really returning here? The code: >> >> >> time_t >> notmuch_message_get_date (notmuch_message_t *message) >> { ... >> return Xapian::sortable_unserialise (value); >> } >> >> But Xapian API says that sortable_unserialise() returns floating type "double" >> >> http://xapian.org/docs/apidoc/html/namespaceXapian.html#326fe2d6b0ee59ac9536f3960e8fd99b >> "Convert a string encoded using sortable_serialise back to a floating >> point number." >> >> But time_t is usually a (signed) long and not floating point. Obviously >> things have worked just fine so far, but is libnotmuch really returning >> the right type here? Sorry, I expose my total lack of basic C++ knowledge >> here... >> > > Converting double to time_t does not look good. Notmuch converts > between time_t and double both when setting and getting the date. I > guess it should work good in most cases at least. Perhaps Carl knows > better that it is safe. A double will precisely represent integers up to 2^53, so this conversion shouldn't be a problem until the year 285422109 or so.