[geary] Round displayed received time to nearest hour



commit e426fd58890c47beec29caf72d1fe39f66a3a86c
Author: Wolfgang Steitz <wsteitz gmail com>
Date:   Wed Feb 26 13:02:39 2014 -0800

    Round displayed received time to nearest hour
    
    Closes: bgo #720843

 src/client/util/util-date.vala |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/client/util/util-date.vala b/src/client/util/util-date.vala
index 8bb3a66..330584b 100644
--- a/src/client/util/util-date.vala
+++ b/src/client/util/util-date.vala
@@ -167,7 +167,8 @@ private string pretty_print_coarse(CoarseDate coarse_date, ClockFormat clock_for
             return ngettext("%dm ago", "%dm ago", (ulong) (diff / TimeSpan.MINUTE)).printf(diff / 
TimeSpan.MINUTE);
         
         case CoarseDate.HOURS:
-            return ngettext("%dh ago", "%dh ago", (ulong) (diff / TimeSpan.HOUR)).printf(diff / 
TimeSpan.HOUR);
+            int rounded = (int) Math.round((double) diff / TimeSpan.HOUR);
+            return ngettext("%dh ago", "%dh ago", (ulong) rounded).printf(rounded);
         
         case CoarseDate.TODAY:
             fmt = xlat_pretty_dates[clock_format.to_index()];


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]