Jelajahi Sumber

tau: fix datetime if the timestamp is in millis

dasman 1 tahun lalu
induk
melakukan
eeddb7ef8c
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 3 1
      bin/tau/tau-python/lib/util.py

+ 3 - 1
bin/tau/tau-python/lib/util.py

@@ -22,7 +22,9 @@ def month_to_unix(month=None):
     return unix
 
 def unix_to_datetime(timestamp):
-    return datetime.fromtimestamp(int(timestamp), UTC)
+    timestamp = int(timestamp)
+    ts = timestamp if timestamp < 1e10 else timestamp/1000
+    return datetime.fromtimestamp(ts, UTC)
 
 task_template = {
     "workspace": str,