Browse Source

Updated timekeeping to include days

action-support
sloum 3 years ago
parent
commit
bd1dff82dd
  1. 10
      gab

10
gab

@ -68,14 +68,24 @@ def diff_time_from_now(t):
diff = time.time() - t
diff = int(diff)
out = ""
# Days
if diff // (3600 * 24) > 0:
days = diff // (3600 * 24)
out += "{}d ".format(days)
diff = diff - (days * 3600 * 24)
# Hours
if diff // 3600 > 0:
out += "{}h ".format(diff // 3600)
diff = diff - (diff // 3600 * 3600)
# Minutes
if diff // 60 > 0:
out += "{}m ".format(diff // 60)
diff = diff - (diff // 60 * 60)
# Seconds
out += "{}s ago".format(diff)
return out

Loading…
Cancel
Save