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)
diff %= T.mins(5).msecs()
if (diff > T.mins(2).plus(T.secs(30)).msecs()) diff -= T.mins(5).msecs()
diff = abs(diff)
return someTime + diff
if (diff > T.mins(2).plus(T.secs(30)).msecs()){
return someTime + abs(diff - T.mins(5).msecs()) // Adjust to the future
} else {
return someTime - diff // adjust to the past
}
}
fun isAbout5minData(aapsLogger: AAPSLogger): Boolean {