Improve rounding of recording interval
This commit is contained in:
parent
c9e8d51802
commit
79457570fa
@ -79,7 +79,8 @@ void saveTemperatures(Temperature* temperatures) {
|
|||||||
}
|
}
|
||||||
// First: Write timestamp
|
// First: Write timestamp
|
||||||
// Timestamp is number of measurement intervals since start of recording
|
// 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*) ×tamp;
|
uint8_t* ptr = (uint8_t*) ×tamp;
|
||||||
saveByte(ptr[0]);
|
saveByte(ptr[0]);
|
||||||
saveByte(ptr[1]);
|
saveByte(ptr[1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user