From bb7590842549ecc30b41366cd1bfed28ad8f6393 Mon Sep 17 00:00:00 2001 From: fpkon <40836557+fpkon@users.noreply.github.com> Date: Fri, 25 Apr 2025 23:31:49 +0200 Subject: [PATCH] fix Issue #8 After setLocalTime() (GMThour == hours) is always true, but GMTtime might still be at another hour. If you return from here, the new GMTtime will not be set in line 307, so GMThour and GMTtime might have different hours. This produced the error in Issue #8 on 2023-10-01. The time was set to 23-00-00, but the above if statement was true and GMTtime not set as expected. The error did not occur with 23-00-01. --- src/SiderealPlanets.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SiderealPlanets.cpp b/src/SiderealPlanets.cpp index 0b56bff..1df77f8 100644 --- a/src/SiderealPlanets.cpp +++ b/src/SiderealPlanets.cpp @@ -287,7 +287,11 @@ boolean SiderealPlanets::setGMTdate(int year, int month, int day) { } boolean SiderealPlanets::setGMTtime(int hours, int minutes, float seconds) { - if (GMThour == hours && GMTminute == minutes && GMTseconds == seconds) return true; //Already done + //if (GMThour == hours && GMTminute == minutes && GMTseconds == seconds) return true; //Already done + //After setLocalTime() (GMThour == hours) is always true, but GMTtime might still be at another hour. + // If you return from here, the new GMTtime will not be set in line 307, so GMThour and GMTtime might have different hours. + // This produced the error in Issue #8 on 2023-10-01. The time was set to 23-00-00, but the above if statement was true and GMTtime not set as expected. + */ if (hours < 0 || hours > 23) return false; else