From 57aa841871022d3296e45aa192ce641a62ea827b Mon Sep 17 00:00:00 2001 From: Xevion Date: Fri, 1 Nov 2024 16:12:16 -0500 Subject: [PATCH] Use datetime.utcnow instead, eliminate timezone consideration --- backend/linkpulse/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/linkpulse/app.py b/backend/linkpulse/app.py index 3348026..31f8570 100644 --- a/backend/linkpulse/app.py +++ b/backend/linkpulse/app.py @@ -115,7 +115,7 @@ async def lifespan(_: FastAPI) -> AsyncIterator[None]: class IPCounter: # Note: This is not the true 'seen' count, but the count of how many times the IP has been seen since the last flush. count: int = 0 - last_seen: datetime = field(default_factory=datetime.now) + last_seen: datetime = field(default_factory=datetime.utcnow) app = FastAPI(lifespan=lifespan) @@ -166,7 +166,7 @@ async def get_ips(request: Request, response: Response): """ Returns a list of partially redacted IP addresses, as well as submitting the user's IP address to the database (buffered). """ - now = datetime.now() + now = datetime.utcnow() # Get the user's IP address user_ip = get_ip(request)