Skip to content
Browse files

Humanized relative time in lastest_scans.

  • Loading branch information...
1 parent ab1b8d0 commit 22acd14daa4a5e053acc12f4f42f7933f550b8ba @sudorandom sudorandom committed
Showing with 4 additions and 3 deletions.
  1. +4 −3 latest_scans.py
View
7 latest_scans.py
@@ -1,5 +1,6 @@
import sqlite3
-import time
+import humanize
+import datetime
if __name__ == "__main__":
conn = sqlite3.connect('data/scans.db')
@@ -10,5 +11,5 @@
_id, _timestamp = result
_created = "unknown"
if _timestamp:
- _created = time.ctime(_timestamp)
- print("scan_id: %s, created: %s" % (_id, _created))
+ _created = humanize.naturaltime(datetime.datetime.fromtimestamp(_timestamp))
+ print("scan_id: %s, created: %s" % (_id, _created))

0 comments on commit 22acd14

Please sign in to comment.
Something went wrong with that request. Please try again.