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);