aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--worker.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/worker.py b/worker.py
index 2e1bb6c..18901ce 100644
--- a/worker.py
+++ b/worker.py
@@ -230,10 +230,14 @@ class ServerWorker(Thread):
"""
update_clients(client_id, camera_id)
- timestamp_string = datetime.datetime.fromtimestamp(
- struct.unpack('d', timestamp)[0]
- ).strftime(TIME_FORMAT_STRING)
- logger.debug("Timestamp string: %r", timestamp_string)
+ try:
+ timestamp_string = datetime.datetime.fromtimestamp(
+ struct.unpack('d', timestamp)[0]
+ ).strftime(TIME_FORMAT_STRING)
+ logger.debug("Timestamp string: %r", timestamp_string)
+ except Exception as exc:
+ logger.error("Error unpacking timestamp: %r, creating from current time!", exc)
+ timestamp_string = datetime.datetime.now().strftime(TIME_FORMAT_STRING) # If it's ok to use current time as fallback, why send timestamp in the first place?
camera_id_string = camera_id.decode('utf-8')
filename = f"{camera_id_string}-{timestamp_string}.mp4"