Improve rounding of recording interval

This commit is contained in:
Christoph Hagen 2023-08-16 10:38:29 +02:00
parent c9e8d51802
commit 79457570fa

View File

@ -79,7 +79,8 @@ void saveTemperatures(Temperature* temperatures) {
}
// First: Write timestamp
// Timestamp is number of measurement intervals since start of recording
uint16_t timestamp = (time(NULL) - startTimeOfCurrentRecording) / 60;
// Add 30 to provide better rounding
uint16_t timestamp = (time(NULL) - startTimeOfCurrentRecording + 30) / 60;
uint8_t* ptr = (uint8_t*) &timestamp;
saveByte(ptr[0]);
saveByte(ptr[1]);