aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2023-06-03 13:39:46 -0400
committerSam Chudnick <sam@chudnick.com>2023-06-03 13:39:46 -0400
commitcb3212d8c076bad4e9c20b63123aba6fcb9e25f4 (patch)
treef488fc14a284bbde11b2774f00036ac8753cf11f
parentbd094f94faf210785d19e005907c6673dde6409d (diff)
Always round hour down instead of either way
-rw-r--r--library.py4
1 files changed, 3 insertions, 1 deletions
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):
33 33
34 34
35def get_current_rounded_time(): 35def get_current_rounded_time():
36 # Gets current time rounded down to the hour
37
36 tz = pytz.timezone("America/New_York") #temp 38 tz = pytz.timezone("America/New_York") #temp
37 cur_time = datetime.datetime.now(tz=tz) 39 cur_time = datetime.datetime.now(tz=tz)
38 cur_time_rounded = cur_time.replace(second=0, microsecond=0, minute=0, hour=cur_time.hour) + datetime.timedelta(hours=cur_time.minute//30) 40 cur_time_rounded = cur_time.replace(second=0, microsecond=0, minute=0, hour=cur_time.hour)
39 return cur_time_rounded 41 return cur_time_rounded
40 42
41 43