CLI: move format_time to common + add timezone

This commit is contained in:
Goffi 2021-09-08 17:58:48 +02:00
commit 44a54978b9

View file

@ -52,6 +52,16 @@ SECURE_UNLINK_DIR = ".backup"
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)