No delay at all for initial timestamp

This commit is contained in:
jbr7rr 2022-12-27 16:48:53 +01:00
parent 96bfb857f7
commit dfdb7857f6

View file

@ -222,9 +222,7 @@ class AutosensDataStoreObject : AutosensDataStore {
return
}
val newBucketedData = ArrayList<InMemoryGlucoseValue>()
// Round time to 1 minute, This sets timestamp a bit in the past, but not much longer that it is noticable
var currentTime = bgReadings[0].timestamp - bgReadings[0].timestamp % T.mins(1).msecs()
var currentTime = bgReadings[0].timestamp
val adjustedTime = adjustToReferenceTime(currentTime)
// after adjusting time may be newer. In this case use T-5min
currentTime = if (adjustedTime > currentTime) adjustedTime - T.mins(5).msecs() else adjustedTime