From 682b512d9b86eecb472ea3bcf89bfb02ee98082b Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 23 Oct 2015 22:09:56 +0200 Subject: [PATCH] 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 --- src/collecty/daemon.py | 5 +++++ 1 file changed, 5 insertions(+) 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) -- 2.47.3