|
5 | 5 | """ |
6 | 6 |
|
7 | 7 | import ast |
8 | | -from datetime import datetime |
| 8 | +from datetime import datetime, timezone |
9 | 9 | import json |
10 | 10 | from json import JSONDecodeError |
11 | 11 |
|
@@ -296,7 +296,7 @@ def __init__( |
296 | 296 | self.object: Object = Object("fake", self.camera) # Initialize with a fake object for Typing |
297 | 297 |
|
298 | 298 | config_msg = self.generate_payload_json( |
299 | | - push_timestamp=int(datetime.utcnow().timestamp()), |
| 299 | + push_timestamp=int(datetime.now(timezone.utc).timestamp()), |
300 | 300 | device_type=os.environ.get("DEVICE_TYPE", "Collector"), |
301 | 301 | id_=self.hostname, |
302 | 302 | deployment_id=os.environ.get( |
@@ -328,7 +328,7 @@ def __init__( |
328 | 328 | # coordinate system to the camera housing fixed (uvw) |
329 | 329 | # coordinate system |
330 | 330 | orientation_msg = self.generate_payload_json( |
331 | | - push_timestamp=int(datetime.utcnow().timestamp()), |
| 331 | + push_timestamp=int(datetime.now(timezone.utc).timestamp()), |
332 | 332 | device_type=os.environ.get("DEVICE_TYPE", "Collector"), |
333 | 333 | id_=self.hostname, |
334 | 334 | deployment_id=os.environ.get( |
@@ -589,7 +589,7 @@ def _config_object(self) -> Dict[str, Any]: |
589 | 589 | def _publish_config(self) -> None: |
590 | 590 | config = self._config_object() |
591 | 591 | config_msg = self.generate_payload_json( |
592 | | - push_timestamp=int(datetime.utcnow().timestamp()), |
| 592 | + push_timestamp=int(datetime.now(timezone.utc).timestamp()), |
593 | 593 | device_type=os.environ.get("DEVICE_TYPE", "Collector"), |
594 | 594 | id_=self.hostname, |
595 | 595 | deployment_id=os.environ.get( |
@@ -746,7 +746,7 @@ def _track_object(self, time_since_last_update: float) -> None: |
746 | 746 | # Log camera pointing using MQTT |
747 | 747 | if self.log_to_mqtt: |
748 | 748 | logger_msg = self.generate_payload_json( |
749 | | - push_timestamp=int(datetime.utcnow().timestamp()), |
| 749 | + push_timestamp=int(datetime.now(timezone.utc).timestamp()), |
750 | 750 | device_type=os.environ.get("DEVICE_TYPE", "Collector"), |
751 | 751 | id_=self.hostname, |
752 | 752 | deployment_id=os.environ.get( |
@@ -996,7 +996,7 @@ def _send_data(self, data: Dict[str, str]) -> bool: |
996 | 996 | """ |
997 | 997 | # Generate payload as JSON |
998 | 998 | payload = self.generate_payload_json( |
999 | | - push_timestamp=int(datetime.utcnow().timestamp()), |
| 999 | + push_timestamp=int(datetime.now(timezone.utc).timestamp()), |
1000 | 1000 | device_type=os.environ.get("DEVICE_TYPE", "Collector"), |
1001 | 1001 | id_=self.hostname, |
1002 | 1002 | deployment_id=os.environ.get( |
@@ -1088,7 +1088,6 @@ def _capture_image(self) -> None: |
1088 | 1088 | ) |
1089 | 1089 |
|
1090 | 1090 | ptz_age = time() - ptz_time |
1091 | | - logging.info(f"PTZ time: {ptz_age}") |
1092 | 1091 | adjusted_rho_c = rho_c + self.rho_dot_c * self.capture_lead_time |
1093 | 1092 | adjusted_tau_c = tau_c + self.tau_dot_c * self.capture_lead_time |
1094 | 1093 | # Note: this time does not include any leading |
|
0 commit comments