diff sat_frontends/jp/common.py @ 3667:9ca19b317293

CLI: move `format_time` to `common` + add timezone
author Goffi <goffi@goffi.org>
date Wed, 08 Sep 2021 17:58:48 +0200
parents 82e616b70a2a
children 742e466fa000
line wrap: on
line diff
--- a/sat_frontends/jp/common.py	Wed Sep 08 17:58:48 2021 +0200
+++ b/sat_frontends/jp/common.py	Wed Sep 08 17:58:48 2021 +0200
@@ -52,6 +52,16 @@
 METADATA_SUFF = "_metadata.json"
 
 
+def format_time(timestamp):
+    """Return formatted date for timestamp
+
+    @param timestamp(str,int,float): unix timestamp
+    @return (unicode): formatted date
+    """
+    fmt = "%d/%m/%Y %H:%M:%S %Z"
+    return time.strftime(fmt, time.localtime(float(timestamp)))
+
+
 def ansi_ljust(s, width):
     """ljust method handling ANSI escape codes"""
     cleaned = regex.ansiRemove(s)