Skip to content

Commit

Permalink
Ensure datetime comparison is the same (native vs aware) (#11789)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 authored Jun 6, 2024
1 parent fc5a926 commit 926d394
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frigate/record/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ def get_datetime_from_timestamp(self, timestamp: int) -> str:
def save_thumbnail(self, id: str) -> str:
thumb_path = os.path.join(CLIPS_DIR, f"export/{id}.webp")

if datetime.datetime.fromtimestamp(self.start_time) < datetime.datetime.now(
datetime.timezone.utc
).replace(minute=0, second=0, microsecond=0):
if datetime.datetime.fromtimestamp(
self.start_time
) < datetime.datetime.now().astimezone(datetime.timezone.utc).replace(
minute=0, second=0, microsecond=0
):
# has preview mp4
try:
preview: Previews = (
Expand Down

0 comments on commit 926d394

Please sign in to comment.