diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/CareLinkDataProcessor.java b/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/CareLinkDataProcessor.java index b89f06ce7c..8e0d593e65 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/CareLinkDataProcessor.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/CareLinkDataProcessor.java @@ -234,8 +234,8 @@ static synchronized void processData(final RecentData recentData, final boolean // Only Guardian Connect, NGP has all in notifications if (recentData.isGM() && recentData.lastAlarm != null) { //Add notification from alarm - if (recentData.lastAlarm.datetime != null && recentData.lastAlarm.kind != null) - addNotification(recentData.lastAlarm.datetime, recentData.getDeviceFamily(), recentData.lastAlarm); + if (recentData.lastAlarm.datetimeAsDate != null && recentData.lastAlarm.kind != null) + addNotification(recentData.lastAlarm.datetimeAsDate, recentData.getDeviceFamily(), recentData.lastAlarm); } } diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/client/CareLinkClient.java b/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/client/CareLinkClient.java index 5392c64f19..f6345d049f 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/client/CareLinkClient.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/client/CareLinkClient.java @@ -645,9 +645,15 @@ protected void correctTimeInRecentData(RecentData recentData) { timezoneMissing = true; - //offset = this.getZonedDate(recentData.lastSG.datetime).getOffset(); - offsetString = this.getZoneOffset(recentData.lastSG.datetime); - + //Try get TZ offset string: lastSG or lastAlarm + if(recentData.lastSG != null && recentData.lastSG.datetime != null) + offsetString = this.getZoneOffset(recentData.lastSG.datetime); + else + offsetString = this.getZoneOffset(recentData.lastAlarm.datetime); + + //Set last alarm datetimeAsDate + if(recentData.lastAlarm != null && recentData.lastAlarm.datetime != null) + recentData.lastAlarm.datetimeAsDate = parseDateString(recentData.lastAlarm.datetime); //Build correct dates with timezone recentData.sMedicalDeviceTime = recentData.sMedicalDeviceTime + offsetString; recentData.medicalDeviceTimeAsString = recentData.medicalDeviceTimeAsString + offsetString; diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/message/Alarm.java b/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/message/Alarm.java index 57bf91712d..71c385f824 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/message/Alarm.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/message/Alarm.java @@ -12,7 +12,8 @@ public String getMessageAlarmCode() { } public int code; - public Date datetime; + public String datetime; + public Date datetimeAsDate; public String type; public boolean flash; public String kind;