Better fix for adjustToReferenceTime()

This commit is contained in:
jbr7rr 2022-12-28 13:33:54 +01:00
parent d863f5d660
commit 0e357d968c

View file

@ -152,9 +152,11 @@ class AutosensDataStoreObject : AutosensDataStore {
} }
var diff = abs(someTime - referenceTime) var diff = abs(someTime - referenceTime)
diff %= T.mins(5).msecs() diff %= T.mins(5).msecs()
if (diff > T.mins(2).plus(T.secs(30)).msecs()) diff -= T.mins(5).msecs() if (diff > T.mins(2).plus(T.secs(30)).msecs()){
diff = abs(diff) return someTime + abs(diff - T.mins(5).msecs()) // Adjust to the future
return someTime + diff } else {
return someTime - diff // adjust to the past
}
} }
fun isAbout5minData(aapsLogger: AAPSLogger): Boolean { fun isAbout5minData(aapsLogger: AAPSLogger): Boolean {