From cb3212d8c076bad4e9c20b63123aba6fcb9e25f4 Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sat, 3 Jun 2023 13:39:46 -0400 Subject: Always round hour down instead of either way --- library.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library.py b/library.py index 2c3fb86..2b9c6d1 100644 --- a/library.py +++ b/library.py @@ -33,9 +33,11 @@ def get_raw_forecast(grid_id, grid_x, grid_y): def get_current_rounded_time(): + # Gets current time rounded down to the hour + tz = pytz.timezone("America/New_York") #temp cur_time = datetime.datetime.now(tz=tz) - cur_time_rounded = cur_time.replace(second=0, microsecond=0, minute=0, hour=cur_time.hour) + datetime.timedelta(hours=cur_time.minute//30) + cur_time_rounded = cur_time.replace(second=0, microsecond=0, minute=0, hour=cur_time.hour) return cur_time_rounded -- cgit v1.2.3