summaryrefslogtreecommitdiff
path: root/board.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'board.cpp')
-rw-r--r--board.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/board.cpp b/board.cpp
index 7766088..b3c5bcb 100644
--- a/board.cpp
+++ b/board.cpp
@@ -212,17 +212,20 @@ QString Board::renderHumanDate(const QDateTime &dateTime)
QString Board::renderHumanTime(const QDateTime &dateTime)
{
+ const QDateTime now = QDateTime::currentDateTime();
QDateTime localDateTime = dateTime.toLocalTime();
- const int secs = localDateTime.secsTo(QDateTime::currentDateTime());
+ const int secs = localDateTime.secsTo(now);
if (secs < 1) {
return tr("Just now");
} else if (secs < 60) {
return tr("%n second(s) ago", 0, secs);
} else if (secs < 3600) {
- int mins = (secs + 10) / 3600; // + 10 to round a bit
+ int mins = (secs + 10) / 60; // + 10 to round a bit
return tr("%n minute(s) ago", 0, mins);
- } else {
+ } else if (localDateTime.daysTo(now) < 1) {
return localDateTime.time().toString(Qt::DefaultLocaleShortDate);
+ } else {
+ return localDateTime.toString(Qt::DefaultLocaleShortDate);
}
}