Skip to content

Commit

Permalink
reduce accuracy of timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan committed Nov 10, 2024
1 parent 03f0a65 commit 71a78b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion klimalogger/data_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion klimalogger/measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit 71a78b4

Please sign in to comment.