sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit a3d7fa37e575a92217eefb154ae02d53c95f812f
parent b0d7364d6574e1b76337ce91f5926359834ef700
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Fri,  5 Jan 2007 16:46:13 +0000

improved accuracy of to_nice_distance_of


git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@183 5c8cc53c-5e98-4d25-b20a-d8db53a31250

Diffstat:
M lib/sup/util.rb | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/sup/util.rb b/lib/sup/util.rb
@@ -224,16 +224,16 @@ class Time
         ["minute", 60],
         ["hour", 24],
         ["day", 7],
-        ["week", 4], # heh heh
+        ["week", 4.345], # heh heh
         ["month", 12],
         ["year", nil],
       ].argfind do |unit, size|
         if diff <= 1
           "one #{unit}"
-        elsif size.nil? || diff < size
-          "#{diff} #{unit}s"
+        elsif size.nil? || diff.round < size
+          "#{diff.round} #{unit}s"
         else
-          diff = (diff / size.to_f).round
+          diff /= size.to_f
           false
         end
       end