From ea3bf14019f3207d3444187fdfc48fa6a311cd23 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 26 Oct 2010 12:54:58 +0900 Subject: [PATCH] if using no points of precision, take the floor --- anki/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/anki/utils.py b/anki/utils.py index f5f95830d..65fe67804 100644 --- a/anki/utils.py +++ b/anki/utils.py @@ -8,7 +8,7 @@ Miscellaneous utilities """ __docformat__ = 'restructuredtext' -import re, os, random, time, types +import re, os, random, time, types, math try: import hashlib @@ -60,6 +60,8 @@ def fmtTimeSpan(time, pad=0, point=0, short=False, after=False): "Return a string representing a time span (eg '2 days')." (type, point) = optimalPeriod(time, point) time = convertSecondsTo(time, type) + if not point: + time = math.floor(time) if short: fmt = shortTimeTable[type] else: @@ -106,7 +108,7 @@ def convertSecondsTo(seconds, type): def _pluralCount(time, point): if point: return 2 - return round(time) + return math.floor(time) # Locale ##############################################################################