File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -151,8 +151,12 @@ void getSunsetTime()
151151 if (doc.containsKey (" results" ) && doc[" results" ].containsKey (" sunset" ))
152152 {
153153 String sunset = doc[" results" ][" sunset" ].as <String>();
154- Config.sunsetHour = (sunset.substring (11 , 13 ).toInt () + Config.timeZone + Config.summerTime + 24 ) % 24 ;
155- Config.sunsetMinute = sunset.substring (14 , 16 ).toInt ();
154+ int16_t sunsetHour = (sunset.substring (11 , 13 ).toInt () + Config.timeZone + Config.summerTime + 24 ) % 24 ;
155+ int16_t sunsetMinute = sunset.substring (14 , 16 ).toInt ();
156+ int16_t minutesSinceMidnight = sunsetHour * 60 + sunsetMinute;
157+ minutesSinceMidnight = (minutesSinceMidnight + Config.sunsetOffset + 1440 ) % 1440 ;
158+ Config.sunsetHour = minutesSinceMidnight / 60 ;
159+ Config.sunsetMinute = minutesSinceMidnight % 60 ;
156160 Config.save ();
157161 PRINTLN (" " + String (Config.sunsetHour ) + " :" + String (Config.sunsetMinute ));
158162 }
You can’t perform that action at this time.
0 commit comments