From 95bf260518ecc54dcbc42ceeed6b51875cde5feb Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 29 Nov 2008 05:10:34 +0000 Subject: [PATCH] Improve ftime() to format dates higher than 11 weeks. --- deluge/common.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deluge/common.py b/deluge/common.py index 479ef9a50..2a8d0c3c0 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -284,7 +284,7 @@ def ftime(seconds): Formats a string to show time in a human readable form :param seconds: int, the number of seconds - :returns: a formatted time string, will return 'unknown' for values greater than 10 weeks and 'Infinity' if seconds == 0 + :returns: a formatted time string, will return 'Infinity' if seconds == 0 :rtype: string **Usage** @@ -311,9 +311,11 @@ def ftime(seconds): return '%dd %dh' % (days, hours) weeks = days / 7 days = days % 7 - if weeks < 10: + if weeks < 52: return '%dw %dd' % (weeks, days) - return 'unknown' + years = weeks / 52 + weeks = weeks % 52 + return '%dy %dw' % (years, weeks) def fdate(seconds): """