#5657 Counted expiring within 1 day as 1 day left

This commit is contained in:
Jerry (Xinyu Hou) 2016-10-14 12:43:01 +01:00
parent 719e64dc8f
commit 33ebe61ef2

View File

@ -101,13 +101,16 @@ unsigned long long
SerialKey::dayLeft(unsigned long long currentTime) const SerialKey::dayLeft(unsigned long long currentTime) const
{ {
unsigned long long timeLeft = 0; unsigned long long timeLeft = 0;
unsigned long long day = 60 * 60 * 24;
if (m_expireTime > currentTime) { if (m_expireTime > currentTime) {
timeLeft = m_expireTime - currentTime; timeLeft = m_expireTime - currentTime;
} }
unsigned long long day = 60 * 60 * 24; unsigned long long dayLeft = 0;
dayLeft = timeLeft % day != 0 ? 1 : 0;
return timeLeft / day; return timeLeft / day + dayLeft;
} }
std::string std::string