Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix datetime.datetime.utcnow() #948

Open
wants to merge 2 commits into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions howdy/src/cli/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Import required modules
import os
import configparser
import datetime
from datetime import timezone, datetime
import snapshot
import paths_factory
from recorders.video_capture import VideoCapture
Expand Down Expand Up @@ -41,7 +41,7 @@
# Generate a snapshot image from the frames
file = snapshot.generate(frames, [
_("GENERATED SNAPSHOT"),
_("Date: ") + datetime.datetime.utcnow().strftime("%Y/%m/%d %H:%M:%S UTC"),
_("Date: ") + datetime.now(timezone.utc).strftime("%Y/%m/%d %H:%M:%S UTC"),
_("Dark threshold config: ") + str(config.getfloat("video", "dark_threshold", fallback=60.0)),
_("Certainty config: ") + str(config.getfloat("video", "certainty", fallback=3.5))
])
Expand Down
4 changes: 2 additions & 2 deletions howdy/src/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import configparser
import dlib
import cv2
import datetime
from datetime import timezone, datetime
import atexit
import subprocess
import snapshot
Expand Down Expand Up @@ -71,7 +71,7 @@ def make_snapshot(type):
"""Generate snapshot after detection"""
snapshot.generate(snapframes, [
type + _(" LOGIN"),
_("Date: ") + datetime.datetime.utcnow().strftime("%Y/%m/%d %H:%M:%S UTC"),
_("Date: ") + datetime.now(timezone.utc).strftime("%Y/%m/%d %H:%M:%S UTC"),
_("Scan time: ") + str(round(time.time() - timings["fr"], 2)) + "s",
_("Frames: ") + str(frames) + " (" + str(round(frames / (time.time() - timings["fr"]), 2)) + "FPS)",
_("Hostname: ") + os.uname().nodename,
Expand Down
4 changes: 2 additions & 2 deletions howdy/src/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Import modules
import cv2
import os
import datetime
from datetime import timezone, datetime
import numpy as np
import paths_factory

Expand Down Expand Up @@ -53,7 +53,7 @@ def generate(frames, text_lines):
os.makedirs(paths_factory.snapshots_dir_path())

# Generate a filename based on the current time
filename = datetime.datetime.utcnow().strftime("%Y%m%dT%H%M%S.jpg")
filename = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%S.jpg")
filepath = paths_factory.snapshot_path(filename)
# Write the image to that file
cv2.imwrite(filepath, snap)
Expand Down