fix recalculated bucketed data

This commit is contained in:
Milos Kozak 2021-10-04 00:34:46 +02:00
parent 9d99913282
commit f790c06b27

View file

@ -237,7 +237,10 @@ class AutosensDataStore {
} }
val newBucketedData = ArrayList<InMemoryGlucoseValue>() val newBucketedData = ArrayList<InMemoryGlucoseValue>()
var currentTime = bgReadings[0].timestamp - bgReadings[0].timestamp % T.mins(5).msecs() var currentTime = bgReadings[0].timestamp - bgReadings[0].timestamp % T.mins(5).msecs()
currentTime = adjustToReferenceTime(currentTime) val adjustedTime = adjustToReferenceTime(currentTime)
// after adjusting time may be newer. In this case use T-5min
if (adjustedTime > currentTime) currentTime = adjustedTime - T.mins(5).msecs()
else currentTime = adjustedTime
aapsLogger.debug("Adjusted time " + dateUtil.dateAndTimeAndSecondsString(currentTime)) aapsLogger.debug("Adjusted time " + dateUtil.dateAndTimeAndSecondsString(currentTime))
//log.debug("First reading: " + new Date(currentTime).toLocaleString()); //log.debug("First reading: " + new Date(currentTime).toLocaleString());
while (true) { while (true) {