fix: the timestamp should be ok now
All checks were successful
ci/woodpecker/push/publish Pipeline was successful

This commit is contained in:
Mylloon 2023-12-24 19:29:26 +01:00
parent 852a30229d
commit 6912a8d7d3
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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: