From 869fbfc4f9fcf0fd98e5f8b51b6bef62db44dff6 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 29 Oct 2022 14:45:52 +0200 Subject: [PATCH] use local hour instead of gmt hour --- camera.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/camera.py b/camera.py index fbdf5ff..3448827 100644 --- a/camera.py +++ b/camera.py @@ -168,8 +168,11 @@ class Camera: time.sleep(1) print('presets loaded') + def get_hour(self): + return time.localtime().tm_hour + def hour_changed(self): - return self.hour is not None and time.gmtime().tm_hour != self.hour + return self.hour is not None and self.get_hour() != self.hour def sleep(self, seconds): n = float(seconds) @@ -189,7 +192,7 @@ class Camera: first = steps[0] steps = steps[1:] if hour_loop: - self.hour = time.gmtime().tm_hour + self.hour = self.get_hour() else: self.hour = None @@ -210,7 +213,7 @@ class Camera: self.segment_times[first['seqid']] = segment_time self.sequence_start = t0 = time.time() for step in steps: - next_hour = time.gmtime().tm_hour + next_hour = self.get_hour() if hour_loop and next_hour != self.hour: self.hour = next_hour break