From 71a78b4127631bce97ab6f85743ae98e6f4bbdd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20W=C3=BCrl?= Date: Sun, 10 Nov 2024 20:45:37 +0100 Subject: [PATCH] reduce accuracy of timestamp --- klimalogger/data_builder.py | 2 +- klimalogger/measurement.py | 3 ++- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/klimalogger/data_builder.py b/klimalogger/data_builder.py index 54d2bf1..5a89643 100644 --- a/klimalogger/data_builder.py +++ b/klimalogger/data_builder.py @@ -10,7 +10,7 @@ class DataBuilder: def __init__(self, configuration: Config): self.location = configuration.client_location_name self.host_name = configuration.client_host_name - self.timestamp = time.time() + self.timestamp = round(time.time(),1) self.data = [] def add(self, sensor: str, measurement_type: str, measurement_unit: str, measurement_value: float, diff --git a/klimalogger/measurement.py b/klimalogger/measurement.py index 1973e62..ea0f5c0 100644 --- a/klimalogger/measurement.py +++ b/klimalogger/measurement.py @@ -37,7 +37,8 @@ def measure(self) -> DataBuilder: start_time = time.time() sensor.measure(data_builder, measurements) end_time = time.time() - data_builder.add(sensor.name, "time", "ms", round((end_time - start_time) * 1e3, 1)) + measurement_duration = round((end_time - start_time) * 1e3, 1) + data_builder.add(sensor.name, "time", "ms", measurement_duration) except Exception: log.exception("measurement of sensor %s failed", sensor) diff --git a/pyproject.toml b/pyproject.toml index e04494b..a639cb1 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "klimalogger" -version = "0.7.17" +version = "0.7.18" description = "Simple data logging client for InfluxDB" authors = ["Andreas Würl "] license = "Apache-2.0"