made friendly time unit returns empty string when time is 0. Fixes 46y display in search dialog

This commit is contained in:
csoler 2016-12-19 23:28:57 +01:00
parent 9d8690bb73
commit 8de9ee8b8d

View File

@ -209,6 +209,9 @@ QString misc::userFriendlyDuration(qlonglong seconds)
QString misc::timeRelativeToNow(uint32_t mtime) QString misc::timeRelativeToNow(uint32_t mtime)
{ {
if(mtime == 0)
return QString();
time_t now = time(NULL) ; time_t now = time(NULL) ;
if(mtime > now) if(mtime > now)
return misc::userFriendlyDuration(mtime - (int)now) + " (ahead of now)"; return misc::userFriendlyDuration(mtime - (int)now) + " (ahead of now)";