From 6912a8d7d396c2509977521531426d1b2878db7b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 24 Dec 2023 19:29:26 +0100 Subject: [PATCH] fix: the timestamp should be ok now --- src/utils/misc.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/misc.py b/src/utils/misc.py index a38db4c..053b23d 100644 --- a/src/utils/misc.py +++ b/src/utils/misc.py @@ -84,8 +84,12 @@ def exist_post(file_id: int) -> float | None: def time_now() -> float: - """get current time with timezone awareness""" - return datetime.now(timezone(session[Config._session_timezone])).timestamp() + """get current time based on timezone""" + now = datetime.utcnow() + return ( + now.timestamp() + + timezone(session[Config._session_timezone]).utcoffset(now).total_seconds() + ) def create_post(file_id: int, content: str) -> bool: