Browse Source

tau: fix datetime if the timestamp is in millis

dasman 1 năm trước cách đây
mục cha
commit
eeddb7ef8c
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  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,