diff options
author | Sam Chudnick <sam@chudnick.com> | 2023-06-03 13:39:46 -0400 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2023-06-03 13:39:46 -0400 |
commit | cb3212d8c076bad4e9c20b63123aba6fcb9e25f4 (patch) | |
tree | f488fc14a284bbde11b2774f00036ac8753cf11f | |
parent | bd094f94faf210785d19e005907c6673dde6409d (diff) |
Always round hour down instead of either way
-rw-r--r-- | library.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -33,9 +33,11 @@ def get_raw_forecast(grid_id, grid_x, grid_y): | |||
33 | 33 | ||
34 | 34 | ||
35 | def get_current_rounded_time(): | 35 | def 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 | ||