From 96bfb857f7322e9ab3ab939b0285b5cad218e95c Mon Sep 17 00:00:00 2001 From: jbr7rr Date: Tue, 27 Dec 2022 12:18:27 +0100 Subject: [PATCH] Set module of timestamp to 1 minute instead of 5 --- .../iob/iobCobCalculator/data/AutosensDataStoreObject.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/main/src/main/java/info/nightscout/plugins/iob/iobCobCalculator/data/AutosensDataStoreObject.kt b/plugins/main/src/main/java/info/nightscout/plugins/iob/iobCobCalculator/data/AutosensDataStoreObject.kt index a31c28441e..60e2e0dc86 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/iob/iobCobCalculator/data/AutosensDataStoreObject.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/iob/iobCobCalculator/data/AutosensDataStoreObject.kt @@ -222,7 +222,9 @@ class AutosensDataStoreObject : AutosensDataStore { return } val newBucketedData = ArrayList() - var currentTime = bgReadings[0].timestamp - bgReadings[0].timestamp % T.mins(5).msecs() + + // 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() 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