From: Michael Tremer Date: Fri, 23 Oct 2015 20:09:56 +0000 (+0200) Subject: Enforce running with UTC X-Git-Tag: 004~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=682b512d9b86eecb472ea3bcf89bfb02ee98082b;p=collecty.git Enforce running with UTC collecty records all data in UTC and writes them to the database in UTC as well. When the system uses a different timezone the database "corrects" the timestamps what we don't want here. Hence we force resetting the timezone to UTC. Signed-off-by: Michael Tremer --- diff --git a/src/collecty/daemon.py b/src/collecty/daemon.py index 0891f8a..eb64571 100644 --- a/src/collecty/daemon.py +++ b/src/collecty/daemon.py @@ -21,6 +21,7 @@ import datetime import multiprocessing +import os import queue import rrdtool import signal @@ -45,6 +46,10 @@ class Collecty(object): def __init__(self, debug=False): self.debug = debug + # Reset timezone to UTC + # rrdtool is reading that from the environment + os.environ["TZ"] = "UTC" + # Enable debug logging when running in debug mode if self.debug: log.setLevel(logging.DEBUG)