From 764306544cea01ac4144c85023240a9640484fb2 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Fri, 10 Jul 2026 10:37:35 +0100 Subject: [PATCH] Send timestamp with simulation frames --- .../things/camera/simulation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/openflexure_microscope_server/things/camera/simulation.py b/src/openflexure_microscope_server/things/camera/simulation.py index e5fe90c1..4c71ed39 100644 --- a/src/openflexure_microscope_server/things/camera/simulation.py +++ b/src/openflexure_microscope_server/things/camera/simulation.py @@ -12,6 +12,7 @@ import io import logging import re import time +from datetime import datetime from threading import Thread from types import TracebackType from typing import Optional, Self, overload @@ -467,9 +468,10 @@ class SimulatedCamera(BaseCamera): last_frame_t = time.time() frame = self.generate_frame() - self.mjpeg_stream.add_frame(_frame2bytes(frame)) + timestamp = datetime.fromtimestamp(last_frame_t) + self.mjpeg_stream.add_frame(_frame2bytes(frame), timestamp) ds_frame = frame.resize((320, 240), resample=Image.Resampling.NEAREST) - self.lores_mjpeg_stream.add_frame(_frame2bytes(ds_frame)) + self.lores_mjpeg_stream.add_frame(_frame2bytes(ds_frame), timestamp) @lt.action def discard_frames(self) -> None: