From 357eadf013d6b7f27a9a7e074bd4ab4b567d1171 Mon Sep 17 00:00:00 2001 From: arlbarto <37982501+arlbarto@users.noreply.github.com> Date: Wed, 13 Dec 2023 00:45:41 +0100 Subject: [PATCH] Update WiFiRTC.md Correction to add the GMT info orginial code: print2digits(rtc.getHours() + GMT); That line is wrong because only adds hours but doesn't contemplate if that sum affects the change of date (adding or subtracting) The correct way is to add/substract 3600 seconds per hour of GMT to the value got from epoch --- content/library-examples/wifi-library/WiFiRTC/WiFiRTC.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/library-examples/wifi-library/WiFiRTC/WiFiRTC.md b/content/library-examples/wifi-library/WiFiRTC/WiFiRTC.md index a64d099290..8d57f181b7 100644 --- a/content/library-examples/wifi-library/WiFiRTC/WiFiRTC.md +++ b/content/library-examples/wifi-library/WiFiRTC/WiFiRTC.md @@ -155,7 +155,7 @@ void setup() { Serial.println(epoch); - rtc.setEpoch(epoch); + rtc.setEpoch(epoch+ GMT*3600); //Add the time zone to the epoch Serial.println(); @@ -176,7 +176,7 @@ void loop() { void printTime() { - print2digits(rtc.getHours() + GMT); + print2digits(rtc.getHours()); Serial.print(":");