From 4bda2227868eb4f5d4bc67e71ab36364c2b6b73d Mon Sep 17 00:00:00 2001 From: Dylan Leonard Date: Sat, 16 Sep 2017 19:27:10 -0400 Subject: [PATCH 1/5] Merge branch 'dev' of C:\Users\Dylan\StudioProjects\AndroidAPS fork with conflicts. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1d3591c8a4..6cbe7a6222 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit From 91f0c2130684ad5d50806c9932d062dbed98f8d5 Mon Sep 17 00:00:00 2001 From: Dylan Leonard Date: Sat, 16 Sep 2017 19:30:07 -0400 Subject: [PATCH 2/5] Changed how time strings are parsed to fix a problem where PM times were being saved as the AM version any time toSeconds was called --- app/src/main/java/info/nightscout/utils/DateUtil.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/utils/DateUtil.java b/app/src/main/java/info/nightscout/utils/DateUtil.java index bf2c1ba1fd..e94188f826 100644 --- a/app/src/main/java/info/nightscout/utils/DateUtil.java +++ b/app/src/main/java/info/nightscout/utils/DateUtil.java @@ -85,15 +85,15 @@ public class DateUtil { } public static int toSeconds(String hh_colon_mm) { - Pattern p = Pattern.compile("(\\d+):(\\d+)( a.m.| p.m.|)"); + Pattern p = Pattern.compile("(\\d+):(\\d+)( a.m.| p.m.| AM | PM)"); Matcher m = p.matcher(hh_colon_mm); int retval = 0; if (m.find()) { retval = SafeParse.stringToInt(m.group(1)) * 60 * 60 + SafeParse.stringToInt(m.group(2)) * 60; - if (m.group(3).equals(" .a.m") && m.group(1).equals("12")) + if (m.group(3).equals(" AM") && m.group(1).equals("12")) retval -= 12 * 60 * 60; - if (m.group(3).equals(" p.m.") && !m.group(1).equals("12")) + if (m.group(3).equals(" PM") && !(m.group(1).equals("12"))) retval += 12 * 60 * 60; } return retval; From db4d203437e82921c0f2f2d0969950dfdb988e97 Mon Sep 17 00:00:00 2001 From: Dylan Leonard Date: Sat, 16 Sep 2017 20:02:08 -0400 Subject: [PATCH 3/5] Revert "Merge branch 'dev' of C:\Users\Dylan\StudioProjects\AndroidAPS fork with conflicts." This reverts commit 4bda2227868eb4f5d4bc67e71ab36364c2b6b73d. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6cbe7a6222..1d3591c8a4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m -org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit From 4f5987b72aedde6e4732aba89680aaa16cd5d306 Mon Sep 17 00:00:00 2001 From: Dylan Leonard Date: Mon, 18 Sep 2017 14:20:28 -0400 Subject: [PATCH 4/5] Added cases to accept both a.m./p.m. and AM/PM --- app/src/main/java/info/nightscout/utils/DateUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/utils/DateUtil.java b/app/src/main/java/info/nightscout/utils/DateUtil.java index e94188f826..ccaae130b7 100644 --- a/app/src/main/java/info/nightscout/utils/DateUtil.java +++ b/app/src/main/java/info/nightscout/utils/DateUtil.java @@ -91,9 +91,9 @@ public class DateUtil { if (m.find()) { retval = SafeParse.stringToInt(m.group(1)) * 60 * 60 + SafeParse.stringToInt(m.group(2)) * 60; - if (m.group(3).equals(" AM") && m.group(1).equals("12")) + if (m.group(3).equals(" a.m.") || m.group(3).equals(" AM") && m.group(1).equals("12")) retval -= 12 * 60 * 60; - if (m.group(3).equals(" PM") && !(m.group(1).equals("12"))) + if (m.group(3).equals(" p.m.") || m.group(3).equals(" PM") && !(m.group(1).equals("12"))) retval += 12 * 60 * 60; } return retval; From d8590fe8f14d011007e80d68b647145fc7e730b2 Mon Sep 17 00:00:00 2001 From: Dylan Leonard Date: Mon, 18 Sep 2017 15:04:46 -0400 Subject: [PATCH 5/5] Clarified boolean logic with parentheses :) --- app/src/main/java/info/nightscout/utils/DateUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/utils/DateUtil.java b/app/src/main/java/info/nightscout/utils/DateUtil.java index ccaae130b7..2410014808 100644 --- a/app/src/main/java/info/nightscout/utils/DateUtil.java +++ b/app/src/main/java/info/nightscout/utils/DateUtil.java @@ -91,9 +91,9 @@ public class DateUtil { if (m.find()) { retval = SafeParse.stringToInt(m.group(1)) * 60 * 60 + SafeParse.stringToInt(m.group(2)) * 60; - if (m.group(3).equals(" a.m.") || m.group(3).equals(" AM") && m.group(1).equals("12")) + if ((m.group(3).equals(" a.m.") || m.group(3).equals(" AM")) && m.group(1).equals("12")) retval -= 12 * 60 * 60; - if (m.group(3).equals(" p.m.") || m.group(3).equals(" PM") && !(m.group(1).equals("12"))) + if ((m.group(3).equals(" p.m.") || m.group(3).equals(" PM")) && !(m.group(1).equals("12"))) retval += 12 * 60 * 60; } return retval;