mirror of https://github.com/djcb/mu.git
* mu-msg-doc: use the UTC-datestr from the database
This commit is contained in:
parent
eb62f52e02
commit
ff8e055564
|
@ -27,6 +27,7 @@
|
|||
#include "mu-msg-fields.h"
|
||||
#include "mu-msg-doc.h"
|
||||
#include "mu-str.h"
|
||||
#include "mu-date.h"
|
||||
|
||||
struct _MuMsgDoc {
|
||||
_MuMsgDoc (Xapian::Document *doc) : _doc (doc) {}
|
||||
|
@ -104,12 +105,18 @@ mu_msg_doc_get_num_field (MuMsgDoc *self, MuMsgFieldId mfid)
|
|||
g_return_val_if_fail (self, -1);
|
||||
g_return_val_if_fail (mu_msg_field_id_is_valid(mfid), -1);
|
||||
g_return_val_if_fail (mu_msg_field_is_numeric(mfid), -1);
|
||||
|
||||
|
||||
/* date is a special case, because we store dates as
|
||||
* strings */
|
||||
try {
|
||||
const std::string s (self->doc().get_value(mfid));
|
||||
if (s.empty())
|
||||
return -1;
|
||||
else
|
||||
else if (mfid == MU_MSG_FIELD_ID_DATE) {
|
||||
time_t t;
|
||||
t = mu_date_str_to_time_t (s.c_str(), FALSE/*utc*/);
|
||||
return static_cast<gint64>(t);
|
||||
} else
|
||||
return static_cast<gint64>(Xapian::sortable_unserialise(s));
|
||||
|
||||
} MU_XAPIAN_CATCH_BLOCK_RETURN(-1);
|
||||
|
|
Loading…
Reference in New Issue