mirror of
https://github.com/tildeclub/ttbp.git
synced 2026-06-19 11:19:24 +00:00
tweaked neighbor view to show last update time instead of feels count
This commit is contained in:
29
bin/util.py
Normal file
29
bin/util.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import inflect
|
||||
import time
|
||||
|
||||
p = inflect.engine()
|
||||
|
||||
def pretty_time(time):
|
||||
m, s = divmod(time, 60)
|
||||
if m > 0:
|
||||
h, m = divmod(m, 60)
|
||||
if h > 0:
|
||||
d, h = divmod(h, 24)
|
||||
if d > 0:
|
||||
w, d = divmod(d, 7)
|
||||
if w > 0:
|
||||
mo, w = divmod(w, 4)
|
||||
if mo > 0:
|
||||
return p.no("month", mo)
|
||||
else:
|
||||
return p.no("week", w)
|
||||
else:
|
||||
return p.no("day", d)
|
||||
else:
|
||||
return p.no("hour", h)
|
||||
else:
|
||||
return p.no("minute", m)
|
||||
else:
|
||||
return p.no("second", s)
|
||||
Reference in New Issue
Block a user