wordclock icon indicating copy to clipboard operation
wordclock copied to clipboard

Hour jumping

Open valknut89 opened this issue 4 years ago • 21 comments

I think I found a mistake. I have a grid in Config of 10×11 and DE_alt. The the hour jumps back and forth between the correct hour and an hour before. every two minutes

valknut89 avatar Nov 30 '20 12:11 valknut89

I have been facing that issue for some time. What did you change to correct it?

fabmsg avatar Nov 30 '20 14:11 fabmsg

I am facing this issue too. For example between 19:25 and 19:26 there seems to be a difference of 1 hour in displayed time.

achkoe avatar Nov 30 '20 16:11 achkoe

we debugged the time.cpp and found that the time zone query changes between 0 and 3600. the HTTP return is sometimes incorrect. So we changed the void loop() and set a fix time in seconds

"void Time::loop() { Time::ntpClient.update();

int h = Time::ntpClient.getHours(); int m = Time::ntpClient.getMinutes();

if(m != Time::minute) { if(m == 0 && h == Time::hour) { h = (h + 1) % 24; }

Time::hour = h;
Time::minute = m; 
Grid::setTime(Time::hour, Time::minute);
Time::ntpClient.setTimeOffset(3600);
Serial.println(h);

} "

valknut89 avatar Nov 30 '20 18:11 valknut89

Do you use the stable version (4.0.1) or the master branch?

napsio avatar Dec 02 '20 13:12 napsio

Do you use the stable version (4.0.1) or the master branch?

I have the same problem with the master branch 4.0.1. But i think, only when i have activate the automatic time zone.

SehlingS avatar Dec 04 '20 09:12 SehlingS

Do you use the stable version (4.0.1) or the master branch?

I can only download one branch from here. So I took this branch

valknut89 avatar Dec 06 '20 18:12 valknut89

Is it possible to fix the timezone? I cannot change it because is greyed out image

fabmsg avatar Dec 06 '20 18:12 fabmsg

Is it possible to fix the timezone? I cannot change it because is greyed out image

You have to restart the device after you set it to inaktiv. then you have the possibility to change the time zone to mabey +1

SehlingS avatar Dec 07 '20 06:12 SehlingS

Hi,

I had the same issue a while ago. Back then it was jumping between 0 and 7200 because of the daylight saving time.

I fixed it that I did not use 0 as a fallback for the timezone, but using the last known timezone if we get a bad response from the time zone provider.

I created a pull-request #10 , you might want to look into it ;)

ibrot avatar Dec 08 '20 14:12 ibrot

This might be only an issue for the master branch. The release 4.0.1 does not have automatic timezones. I'll check the #10 pull-request.

napsio avatar Dec 12 '20 18:12 napsio

where can i download 4.0.1 ?

valknut89 avatar Dec 12 '20 21:12 valknut89

thank you for your great work

valknut89 avatar Dec 12 '20 22:12 valknut89

In Master-Branch the Option "Automatische Zeitzone" is reset to "Aktiv" after set "Inaktiv" and coldstart ESP.

valknut89 avatar Dec 16 '20 17:12 valknut89

i can confirm that, but the automatic will work fine with the last changes from ibrot.

SehlingS avatar Dec 17 '20 07:12 SehlingS

"Automatische Zeitzone" for me in germany is not working.. offset is not correct. Also Manual offset is not working.

LoenzeDoenz avatar Dec 18 '20 15:12 LoenzeDoenz

I can send you a ready to flash bin to test it out. Maybe you use other libarys.

wordclock.ino.d1_mini.bin_11x11_de_DE_Gridfirst2_gridsingleminute1.zip

SehlingS avatar Dec 19 '20 13:12 SehlingS

we debugged the time.cpp and found that the time zone query changes between 0 and 3600. the HTTP return is sometimes incorrect. So we changed the void loop() and set a fix time in seconds

"void Time::loop() { Time::ntpClient.update();

int h = Time::ntpClient.getHours(); int m = Time::ntpClient.getMinutes();

if(m != Time::minute) { if(m == 0 && h == Time::hour) { h = (h + 1) % 24; }

Time::hour = h;
Time::minute = m; 
Grid::setTime(Time::hour, Time::minute);
Time::ntpClient.setTimeOffset(3600);
Serial.println(h);

} "

also with this one the automatic modus ist still one hour wrong..
is shows "9:00" but should be "10:00".

edit: it still jumps

p3moto avatar Jan 03 '21 20:01 p3moto

we debugged the time.cpp and found that the time zone query changes between 0 and 3600. the HTTP return is sometimes incorrect. So we changed the void loop() and set a fix time in seconds "void Time::loop() { Time::ntpClient.update(); int h = Time::ntpClient.getHours(); int m = Time::ntpClient.getMinutes(); if(m != Time::minute) { if(m == 0 && h == Time::hour) { h = (h + 1) % 24; }

Time::hour = h;
Time::minute = m; 
Grid::setTime(Time::hour, Time::minute);
Time::ntpClient.setTimeOffset(3600);
Serial.println(h);

} "

also with this one the automatic modus ist still one hour wrong.. but is seems to be constantly wrong and dosent jump anymore is shows "9:00" but should be "10:00".

With this version there is no automatic mode. It isn't wrong, it is fixed to a special timezone. The webinterface has to ne changed too With this time.cpp.

valknut89 avatar Jan 04 '21 12:01 valknut89

we debugged the time.cpp and found that the time zone query changes between 0 and 3600. the HTTP return is sometimes incorrect. So we changed the void loop() and set a fix time in seconds "void Time::loop() { Time::ntpClient.update(); int h = Time::ntpClient.getHours(); int m = Time::ntpClient.getMinutes(); if(m != Time::minute) { if(m == 0 && h == Time::hour) { h = (h + 1) % 24; }

Time::hour = h;
Time::minute = m; 
Grid::setTime(Time::hour, Time::minute);
Time::ntpClient.setTimeOffset(3600);
Serial.println(h);

} "

also with this one the automatic modus ist still one hour wrong.. is shows "9:00" but should be "10:00".

edit: it still jumps

With this version there is no automatic mode. It isn't wrong, it is fixed to a special timezone. The webinterface has to ne changed too With this time.cpp.

the time still jumpes...

i added this lines Time::ntpClient.setTimeOffset(3600); Serial.println(h); in the code of the time.cpp, like: grafik

"The webinterface has to be changed too With this time.cpp." no it did not change anything there... still could use automatic timezone

maybe i missunderstood sth. i dont have a clue of C++.

p3moto avatar Jan 04 '21 15:01 p3moto

we debugged the time.cpp and found that the time zone query changes between 0 and 3600. the HTTP return is sometimes incorrect. So we changed the void loop() and set a fix time in seconds "void Time::loop() { Time::ntpClient.update(); int h = Time::ntpClient.getHours(); int m = Time::ntpClient.getMinutes(); if(m != Time::minute) { if(m == 0 && h == Time::hour) { h = (h + 1) % 24; }

Time::hour = h;
Time::minute = m; 
Grid::setTime(Time::hour, Time::minute);
Time::ntpClient.setTimeOffset(3600);
Serial.println(h);

} "

also with this one the automatic modus ist still one hour wrong.. is shows "9:00" but should be "10:00". edit: it still jumps

With this version there is no automatic mode. It isn't wrong, it is fixed to a special timezone. The webinterface has to ne changed too With this time.cpp.

the time still jumpes...

i added this lines Time::ntpClient.setTimeOffset(3600); Serial.println(h); in the code of the time.cpp, like: grafik

"The webinterface has to be changed too With this time.cpp." no it did not change anything there... still could use automatic timezone

maybe i missunderstood sth. i dont have a clue of C++.

pls have a look at #9 (comment) and you have to delete line 31-34 in your code, insert line "Time::ntpClient.setTimeOffset(3600);" also to setup in time.cpp You can try the version 4.0.1. There is no auto-timezone

valknut89 avatar Jan 04 '21 15:01 valknut89