Avoid using the return value of localtime_r, it's sometimes null on windows.
This commit is contained in:
parent
6d7a1c01f8
commit
481ca31786
1 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue