diff --git a/config.py b/config.py index fd8df32..04b0d42 100644 --- a/config.py +++ b/config.py @@ -4,5 +4,4 @@ user="praktyki" password="2a7driUITXFy73tO" port="5432" default_file = "default.squashfs" -webssh_port = "8000" -timezone = "UTC" \ No newline at end of file +webssh_port = "8000" \ No newline at end of file diff --git a/db.py b/db.py index 385df56..952bd86 100644 --- a/db.py +++ b/db.py @@ -19,7 +19,7 @@ def connect(): cur = conn.cursor() with conn.cursor() as cur: - cur.execute("SET TIMEZONE = %s", (config.timezone,)) + cur.execute("SET TIMEZONE = 'UTC';") conn.commit() cur.execute(""" CREATE TABLE IF NOT EXISTS image ( diff --git a/utils.py b/utils.py index d158135..797525a 100644 --- a/utils.py +++ b/utils.py @@ -64,10 +64,10 @@ class PingThread(threading.Thread): print(date) if date is None: return - delta = datetime.datetime.now() - date - print(datetime.datetime.now()) + delta = datetime.datetime.utcnow() - date + print(datetime.datetime.utcnow()) print(delta.total_seconds()) - if delta.total_seconds() < -30: + if delta.total_seconds() > 30: db.del_image_allocation_id(self.Id) print("deleted") else: