From 35bbbd5e23b4da8f00986ef6a37fc2a4d55526a5 Mon Sep 17 00:00:00 2001 From: alv-cor Date: Mon, 19 Jan 2026 15:38:15 +0100 Subject: [PATCH 1/2] Use LocalDate for session start time calculation Replaced System.currentTimeMillis() with LocalDate.now().atTime(...).atZone(...).toInstant().toEpochMilli() for more accurate session start time based on the routine's scheduled time and system time zone. --- Reef/src/main/java/dev/pranav/reef/routine/Routines.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Reef/src/main/java/dev/pranav/reef/routine/Routines.kt b/Reef/src/main/java/dev/pranav/reef/routine/Routines.kt index 1f96039..223d91c 100644 --- a/Reef/src/main/java/dev/pranav/reef/routine/Routines.kt +++ b/Reef/src/main/java/dev/pranav/reef/routine/Routines.kt @@ -12,6 +12,8 @@ import dev.pranav.reef.util.prefs import org.json.JSONArray import org.json.JSONObject import java.time.DayOfWeek +import java.time.LocalDate +import java.time.ZoneId import java.util.UUID /** @@ -155,7 +157,7 @@ object Routines { val newSession = ActiveSession( routineId = routine.id, - startTime = System.currentTimeMillis(), + startTime = LocalDate.now().atTime(routine.schedule.time).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(),, limits = routine.limits.associate { it.packageName to it.limitMinutes * 60_000L } ) sessions.add(newSession) From f21216b87e442d12654a9fbc7e018b413677240e Mon Sep 17 00:00:00 2001 From: alv-cor <58772226+alv-cor@users.noreply.github.com> Date: Mon, 19 Jan 2026 16:30:38 +0100 Subject: [PATCH 2/2] Fix syntax error in startTime assignment --- Reef/src/main/java/dev/pranav/reef/routine/Routines.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Reef/src/main/java/dev/pranav/reef/routine/Routines.kt b/Reef/src/main/java/dev/pranav/reef/routine/Routines.kt index 223d91c..13db014 100644 --- a/Reef/src/main/java/dev/pranav/reef/routine/Routines.kt +++ b/Reef/src/main/java/dev/pranav/reef/routine/Routines.kt @@ -157,7 +157,7 @@ object Routines { val newSession = ActiveSession( routineId = routine.id, - startTime = LocalDate.now().atTime(routine.schedule.time).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(),, + startTime = LocalDate.now().atTime(routine.schedule.time).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(), limits = routine.limits.associate { it.packageName to it.limitMinutes * 60_000L } ) sessions.add(newSession)