From 7314cb1591af4b3416584c6c0742604296145742 Mon Sep 17 00:00:00 2001 From: acockburn Date: Mon, 23 Jan 2023 09:49:47 -0500 Subject: [PATCH] History --- appdaemon/scheduler.py | 6 ++++-- docs/HISTORY.rst | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/appdaemon/scheduler.py b/appdaemon/scheduler.py index 78caf9982..0fefb39ee 100644 --- a/appdaemon/scheduler.py +++ b/appdaemon/scheduler.py @@ -774,8 +774,10 @@ async def now_is_between(self, start_time_str, end_time_str, name=None): start_time = (await self._parse_time(start_time_str, name))["datetime"] end_time = (await self._parse_time(end_time_str, name))["datetime"] now = (await self.get_now()).astimezone(self.AD.tz) - start_date = now.replace(hour=start_time.hour, minute=start_time.minute, second=start_time.second) - end_date = now.replace(hour=end_time.hour, minute=end_time.minute, second=end_time.second) + start_date = now.replace( + hour=start_time.hour, minute=start_time.minute, second=start_time.second, microsecond=0 + ) + end_date = now.replace(hour=end_time.hour, minute=end_time.minute, second=end_time.second, microsecond=0) if end_date < start_date: # Spans midnight if now < start_date and now < end_date: diff --git a/docs/HISTORY.rst b/docs/HISTORY.rst index 39d5bb734..1d4a7a928 100644 --- a/docs/HISTORY.rst +++ b/docs/HISTORY.rst @@ -18,6 +18,7 @@ Change Log - Fixed issue with setup file saying support "python3 3.0" - Fixed issue with the inability to know which app's callback failed `constrain_state` check - Fixed issue with AD giving messed up error messages +- Fixed an issue with scheduler.now_is_between() where it wasn;t zeroing out microseconds leading to race conditions - Documentation fixes - contributed by `Rootie `__ - Documentation fixes - contributed by `Jakob Ruhe `__ - Documentation fixes - contributed by `illuzn `__