diff options
author | Dan McGee <dan@archlinux.org> | 2010-09-22 00:39:46 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-09-22 00:39:46 +0200 |
commit | b3883820a249a0bb6ba6237f815b8cdffd630fcd (patch) | |
tree | 5c17812e1dde0c2885bf3520f435debc3e1122c9 /mirrors/templatetags/mirror_status.py | |
parent | 4a99d313bfb2a226e6777a39a9a8588106f42685 (diff) | |
parent | 8ff8190c5ca29473cbcc398fb12b33b4430cc050 (diff) | |
download | archweb-b3883820a249a0bb6ba6237f815b8cdffd630fcd.tar.gz archweb-b3883820a249a0bb6ba6237f815b8cdffd630fcd.tar.xz |
Merge branch 'mirror-check'
Diffstat (limited to 'mirrors/templatetags/mirror_status.py')
-rw-r--r-- | mirrors/templatetags/mirror_status.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mirrors/templatetags/mirror_status.py b/mirrors/templatetags/mirror_status.py new file mode 100644 index 0000000..09c5b33 --- /dev/null +++ b/mirrors/templatetags/mirror_status.py @@ -0,0 +1,15 @@ +from django import template + +register = template.Library() + +@register.filter +def duration(value): + if not value: + return u'\u221e' + # does not take microseconds into account + total_secs = value.seconds + value.days * 24 * 3600 + mins, secs = divmod(total_secs, 60) + hrs, mins = divmod(mins, 60) + return '%d:%02d' % (hrs, mins) + +# vim: set ts=4 sw=4 et: |