Merge pull request #151 from AdrianLxM/patch-15

rounding minutesago instead of truncating it
This commit is contained in:
Milos Kozak 2017-02-06 12:03:14 +01:00 committed by GitHub
commit adaa20e5e4

View file

@ -81,9 +81,9 @@ public class GlucoseStatus {
BgReading then = data.get(i); BgReading then = data.get(i);
long then_date = then.timeIndex; long then_date = then.timeIndex;
double avgdelta = 0; double avgdelta = 0;
int minutesago; long minutesago;
minutesago = Math.round((now_date - then_date) / (1000 * 60)); minutesago = Math.round((now_date - then_date) / (1000d * 60));
// multiply by 5 to get the same units as delta, i.e. mg/dL/5m // multiply by 5 to get the same units as delta, i.e. mg/dL/5m
change = now.value - then.value; change = now.value - then.value;
avgdelta = change / minutesago * 5; avgdelta = change / minutesago * 5;