From f333fc7e5668d488d8c379492961cbb03453ad34 Mon Sep 17 00:00:00 2001 From: lemoer Date: Fri, 27 Dec 2024 20:16:06 +0100 Subject: [PATCH] main: use current timezone in favor of utc --- main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index f60fc4f..656258f 100644 --- a/main.py +++ b/main.py @@ -21,6 +21,9 @@ class Config(BaseModel): def signal_timestamp_to_datetime(timestamp: str) -> datetime.datetime: return datetime.datetime.fromtimestamp(int(timestamp)/1000) +def now(): + return datetime.datetime.now() + T = TypeVar("T") class Changes[T](BaseModel): @@ -391,8 +394,8 @@ class LabCleaningBot: if is_err(sync_result): print(sync_result.unwrap_err()) - for task in get_active_tasks(session, utc_now()): - reqs = task.create_additional_requests(utc_now(), session) + for task in get_active_tasks(session, now()): + reqs = task.create_additional_requests(now(), session) if is_err(reqs): if task not in unfulfillable_tasks: @@ -424,7 +427,7 @@ You have time to answer for {format_seconds(task.timeout)}.""" print(res.unwrap_err()) # check for timeouts - for request in task.freshly_expired_requests(datetime.datetime.now()): + for request in task.freshly_expired_requests(now()): print("Request expired:", repr(request)) message = SendMessageSimple( message="You did not respond to the task request in time.",