From 4106ce8cb39865cec36ce3fb28c1e4cc76fc8092 Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 18 Apr 2025 18:54:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8B=8D=E7=85=A7=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=9A=84=E6=B3=A8=E5=86=8C=E5=A4=84=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=A7=8B=E6=97=B6=E9=92=9F=E4=B8=A2=E5=A4=B1?= =?UTF-8?q?=E6=A0=A1=E6=97=B6=E6=88=90=E5=8A=9F=E4=B9=8B=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/xypower/mpapp/MicroPhotoService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java index 251da4be..8fd4e567 100644 --- a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java +++ b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java @@ -507,7 +507,14 @@ public class MicroPhotoService extends Service { } // Register Next Photo Timer - long startTime = (ts == 0) ? (((new Date()).getTime() + 999) / 1000 + 1) : (ts + 1); // Add one second + long startTime = (System.currentTimeMillis() + 999) / 1000 + 1; + if (ts != 0 && (startTime - ts) < 86400) { + // Ts != 0 means schedule time + // if ts is not during a day, the time is wrong, just use current system time + // if ts is valid schedule time, will use next time point + Log.e(TAG, "Current Photo Timer(" + ts + ") is wrong and use current system time"); + startTime = ts + 1; + } mService.updateCaptureSchedule(startTime); } else if (TextUtils.equals(ACTION_HEARTBEAT_MANUALLY, action)) { Log.i(TAG, "HB Timer Fired ACTION=" + action);