The Problem:
We receive the correct timestamp from the Smartmeter, which already considers time zones, but the function mktime() always assumes a UTC time. That is why we have to substract 1 or 2 hours depending on summer/winter time.
Possible Solutions:
get timezone from NTP client so it takes daylight saving time automatically into account
omit the timestamp completely and use -1 as timestamp parameter, see graphite docs
timestamp is the number of seconds since unix epoch time. Carbon-cache will use the time of arrival if the timestamp is set to -1.
When using the last approach, consider that each metric will have a slight delay and not the same timestamp.
The Problem: We receive the correct timestamp from the Smartmeter, which already considers time zones, but the function
mktime()
always assumes a UTC time. That is why we have to substract 1 or 2 hours depending on summer/winter time.Possible Solutions:
When using the last approach, consider that each metric will have a slight delay and not the same timestamp.
https://github.com/mitsubishievo99/esp-smartmeter-netznoe/blob/6b2d2c7ca1f2359c54c7edd122f97d3adf947f2f/src/main.cpp#L146