This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

#5657 Counted expiring within 1 day as 1 day left

  • Loading branch information...
Jerry (Xinyu Hou)
Jerry (Xinyu Hou) committed Oct 14, 2016
1 parent 719e64d commit 33ebe61ef21d13fea7a6c6c9858ad2303d595540
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/lib/shared/SerialKey.cpp
@@ -101,13 +101,16 @@ unsigned long long
SerialKey::dayLeft(unsigned long long currentTime) const
{
unsigned long long timeLeft = 0;
+ unsigned long long day = 60 * 60 * 24;
+
if (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

0 comments on commit 33ebe61

Please sign in to comment.