Utility: Make the timeAgoInWords method a bit more verbose
authorKlaas Freitag <freitag@owncloud.com>
Mon, 15 Feb 2016 16:58:32 +0000 (17:58 +0100)
committerKlaas Freitag <freitag@owncloud.com>
Mon, 15 Feb 2016 16:59:24 +0000 (17:59 +0100)
src/libsync/utility.cpp

index e511d80417c3895435a654b21dea9cf5668281cc..85e42c4e35ac7edc727605424cb490a8852440f1 100644 (file)
@@ -445,14 +445,20 @@ QString Utility::timeAgoInWords(const QDateTime& dt, const QDateTime& from)
         return QObject::tr("%1 day(s) ago", "", dtn).arg(dtn);
     } else {
         qint64 secs = dt.secsTo(now);
-
+        if( secs < 0 ) {
+            return QObject::tr("in the future");
+        }
         if( floor(secs / 3600.0) > 0 ) {
             int hours = floor(secs/3600.0);
             return( QObject::tr("%1 hour(s) ago", "", hours).arg(hours));
         } else {
             int minutes = qRound(secs/60.0);
             if( minutes == 0 ) {
-                return QObject::tr("Less than a minute ago");
+                if(secs < 5) {
+                    return QObject::tr("now");
+                } else {
+                    return QObject::tr("Less than a minute ago");
+                }
             }
             return( QObject::tr("%1 minute(s) ago", "", minutes).arg(minutes));
         }