This commit is contained in:
Mateusz779 2023-04-21 10:59:34 +02:00
parent 5af4a65501
commit cf2c40e5b4
3 changed files with 5 additions and 6 deletions

View File

@ -4,5 +4,4 @@ user="praktyki"
password="2a7driUITXFy73tO" password="2a7driUITXFy73tO"
port="5432" port="5432"
default_file = "default.squashfs" default_file = "default.squashfs"
webssh_port = "8000" webssh_port = "8000"
timezone = "UTC"

2
db.py
View File

@ -19,7 +19,7 @@ def connect():
cur = conn.cursor() cur = conn.cursor()
with conn.cursor() as cur: with conn.cursor() as cur:
cur.execute("SET TIMEZONE = %s", (config.timezone,)) cur.execute("SET TIMEZONE = 'UTC';")
conn.commit() conn.commit()
cur.execute(""" cur.execute("""
CREATE TABLE IF NOT EXISTS image ( CREATE TABLE IF NOT EXISTS image (

View File

@ -64,10 +64,10 @@ class PingThread(threading.Thread):
print(date) print(date)
if date is None: if date is None:
return return
delta = datetime.datetime.now() - date delta = datetime.datetime.utcnow() - date
print(datetime.datetime.now()) print(datetime.datetime.utcnow())
print(delta.total_seconds()) print(delta.total_seconds())
if delta.total_seconds() < -30: if delta.total_seconds() > 30:
db.del_image_allocation_id(self.Id) db.del_image_allocation_id(self.Id)
print("deleted") print("deleted")
else: else: