From 481ca3178671bf89ecd66cc55e2dbc0b95d2f78f Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sun, 15 Nov 2015 16:07:01 +0100 Subject: [PATCH] Avoid using the return value of localtime_r, it's sometimes null on windows. --- src/rcldb/rcldb.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index 51caccc1..87da3870 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -1422,11 +1422,11 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi, Doc &doc) time_t mtime = atoll(doc.dmtime.empty() ? doc.fmtime.c_str() : doc.dmtime.c_str()); struct tm tmb; - struct tm *tmbp = &tmb; - tmbp = localtime_r(&mtime, &tmb); - char buf[9]; - snprintf(buf, 9, "%04d%02d%02d", - tmbp->tm_year+1900, tmbp->tm_mon + 1, tmbp->tm_mday); + localtime_r(&mtime, &tmb); + char buf[9]; + snprintf(buf, 9, "%04d%02d%02d", + tmb.tm_year+1900, tmb.tm_mon + 1, tmb.tm_mday); + // Date (YYYYMMDD) newdocument.add_boolean_term(wrap_prefix(xapday_prefix) + string(buf)); // Month (YYYYMM)