mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
if using no points of precision, take the floor
This commit is contained in:
parent
5bc7c390a0
commit
ea3bf14019
1 changed files with 4 additions and 2 deletions
|
@ -8,7 +8,7 @@ Miscellaneous utilities
|
||||||
"""
|
"""
|
||||||
__docformat__ = 'restructuredtext'
|
__docformat__ = 'restructuredtext'
|
||||||
|
|
||||||
import re, os, random, time, types
|
import re, os, random, time, types, math
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import hashlib
|
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')."
|
"Return a string representing a time span (eg '2 days')."
|
||||||
(type, point) = optimalPeriod(time, point)
|
(type, point) = optimalPeriod(time, point)
|
||||||
time = convertSecondsTo(time, type)
|
time = convertSecondsTo(time, type)
|
||||||
|
if not point:
|
||||||
|
time = math.floor(time)
|
||||||
if short:
|
if short:
|
||||||
fmt = shortTimeTable[type]
|
fmt = shortTimeTable[type]
|
||||||
else:
|
else:
|
||||||
|
@ -106,7 +108,7 @@ def convertSecondsTo(seconds, type):
|
||||||
def _pluralCount(time, point):
|
def _pluralCount(time, point):
|
||||||
if point:
|
if point:
|
||||||
return 2
|
return 2
|
||||||
return round(time)
|
return math.floor(time)
|
||||||
|
|
||||||
# Locale
|
# Locale
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
Loading…
Reference in a new issue