X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=p2pool%2Futil%2Fmath.py;h=04ed3ffa2ed2d2f0cf78c5292a68f5f3be702bc9;hb=62a65ed608004510a8207ba16a2acacfd3aaef24;hp=c13494f2f4c30fa9dc1f8b4ba1146c4b2336ec69;hpb=5da97a50d3213f367533ecbd42490d0db7d47313;p=p2pool.git diff --git a/p2pool/util/math.py b/p2pool/util/math.py index c13494f..04ed3ff 100644 --- a/p2pool/util/math.py +++ b/p2pool/util/math.py @@ -82,7 +82,7 @@ def format(x): return '%i' % (x,) + s def format_dt(dt): - for value, name in [(60*60*24, 'days'), (60*60, 'hours'), (60, 'minutes'), (1, 'seconds')]: + for value, name in [(365.2425*60*60*24, 'years'), (60*60*24, 'days'), (60*60, 'hours'), (60, 'minutes'), (1, 'seconds')]: if dt > value: break return '%.01f %s' % (dt/value, name) @@ -179,7 +179,7 @@ def natural_to_string(n, alphabet=None): if n < 0: raise TypeError('n must be a natural') if alphabet is None: - s = '%x' % (n,) + s = ('%x' % (n,)).lstrip('0') if len(s) % 2: s = '0' + s return s.decode('hex')