Skip to content
Snippets Groups Projects
Commit 921a60e8 authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

Improved printing functions to also accept None values

parent 769d40bc
Branches
Tags
No related merge requests found
......@@ -569,6 +569,8 @@ def nbToDataAmount(n):
'''converts a number into a readable amount of data'''
ext = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB']
magn = 0
if n == None:
return '-'
while n / 1024 > 5:
magn += 1
n = n / 1024
......@@ -584,6 +586,8 @@ def printPercentage(portion, total):
def nbToAge(n):
'''converts a number of seconds into a readable age'''
s = ''
if n == None:
return '-'
if n >= 86400:
s = s + str(int(n/86400)) + 'd'
n = n % 86400
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment