From 6b518e8ddcaa9f3194bff3767bddc0575d6cf1a7 Mon Sep 17 00:00:00 2001 From: Martinez Date: Thu, 20 Oct 2016 17:03:17 +0200 Subject: [PATCH] add timezone support to over.text.Output --- over/text.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/over/text.py b/over/text.py index 7da1236..c4e312c 100644 --- a/over/text.py +++ b/over/text.py @@ -11,6 +11,7 @@ import struct import sys import time import termios +import tzlocal # -------------------------------------------------- @@ -322,7 +323,7 @@ class Output: - indentation start marker """ - def __init__(self, name, format="[%Y-%m-%d %H:%M:%S] <@> -- , ", colors=True, end=".\n", indent=True, stream=sys.stderr): + def __init__(self, name, format="[%Y-%m-%d %H:%M:%S %Z] <@> -- , ", colors=True, end=".\n", indent=True, stream=sys.stderr): self.name = name self.format = format self.colors = colors and stream.isatty() @@ -340,7 +341,7 @@ class Output: colors = colors or self.colors end = end or self.end - output = datetime.datetime.now().strftime(format) + output = datetime.datetime.now(tzlocal.get_localzone()).strftime(format) output = output.replace("<@>", tag) output = output.replace("", self.name)