Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: 'timezone' does not name a type #25

Open
tatuiot opened this issue Nov 10, 2021 · 3 comments
Open

error: 'timezone' does not name a type #25

tatuiot opened this issue Nov 10, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@tatuiot
Copy link

tatuiot commented Nov 10, 2021

Hi , thanks for your library.
I managed to make it work commenting out the line
timezone timeZone; ///< @brief
But it happens that the time displayed is 6hrs ahead of the real time... It was working last week... but now... suddenly... it stopped working properly and I cannot make it work again.

I am using VSCode 1.62.1 / Platformio 5.2.3 / ESP32 Dev Kit1 / ESPNtpClient 0.2.5

uint8_t initNTP(void)
{
    NTP.setTimeZone(TZ_America_Argentina_Buenos_Aires);
    NTP.setInterval(600);
    NTP.setNTPTimeout(NTP_TIMEOUT);
    //NTP.setMinSyncAccuracy (5000);
    //NTP.settimeSyncThreshold (3000);
    NTP.begin(ntpServer);
    Serial.println(F("NTP CONFIGURED"));
    return 0;
}

I am lost... thanks in advance any tip please share...

here is the log output.

[I][ESPNtpClient.cpp:807] 266548 setInterval(): Sync interval set to 600 s
[I][ESPNtpClient.cpp:852] 266548 setNTPTimeout(): Set NTP timeout to 5000 ms
[I][ESPNtpClient.cpp:796] 266548 setNtpServerName(): NTP server set to ar.pool.ntp.org
[I][ESPNtpClient.cpp:164] 266548 begin(): Got server name
[I][ESPNtpClient.cpp:179] 266444 begin(): NTP socket created
[I][ESPNtpClient.cpp:186] 266444 begin(): Bind UDP port 123 to 192.168.100.142
[I][ESPNtpClient.cpp:213] 266444 begin(): Time sync started. NExt sync in 5500 ms
NTP CONFIGURED
[I][ESPNtpClient.cpp:521] 260548 s_getTimeloop(): Periodic loop. Millis = 16918
[I][ESPNtpClient.cpp:615] 257968 getTime(): NTP server address resolved to 168.96.251.227
[I][ESPNtpClient.cpp:639] 257996 getTime(): NTP server IP address 168.96.251.227
[I][ESPNtpClient.cpp:662] 257996 getTime(): Sending UDP packet
[I][ESPNtpClient.cpp:665] 257996 getTime(): Status set to REQUESTED
[I][ESPNtpClient.cpp:715] 257588 sendNTPpacket(): sendNTPpacket
[I][ESPNtpClient.cpp:736] 257588 sendNTPpacket(): Sending packet
[I][ESPNtpClient.cpp:749] 257508 sendNTPpacket(): UDP packet sent
[I][ESPNtpClient.cpp:457] 257408 s_recvPacket(): NTP Packet received from 168.96.251.227:123
[I][ESPNtpClient.cpp:892] 257480 decodeNtpMessage(): Decoded NTP message
[I][ESPNtpClient.cpp:1058] 257480 calculateOffset(): Offset: 1636569276.690566, Delay: 0.027704
[I][ESPNtpClient.cpp:1063] 256884 calculateOffset(): Calculated offset 1636569276.690566 sec. Delay 27.703886 ms
[I][ESPNtpClient.cpp:308] 256884 processPacket(): offset 1636569276690566 -- sum 1636569276690566 -- round 1 -- average 1636569276690566
[I][ESPNtpClient.cpp:383] 256884 processPacket(): Valid NTP response
[I][ESPNtpClient.cpp:1106] 255168 adjustOffset(): Hard adjust
[I][ESPNtpClient.cpp:1109] 256884 adjustOffset(): Offset adjusted
[W][ESPNtpClient.cpp:400] 256884 processPacket(): Minimum accuracy not reached. Repeating sync
[I][ESPNtpClient.cpp:402] 256884 processPacket(): Status set to PARTIAL SYNC
[I][ESPNtpClient.cpp:428] 256884 processPacket(): Interval set to = 5500
[I][ESPNtpClient.cpp:429] 256884 processPacket(): Successful NTP sync at 10/11/2021 21:34:53  
...
[I][ESPNtpClient.cpp:615] 259092 getTime(): NTP server address resolved to 168.96.251.227
[I][ESPNtpClient.cpp:639] 259092 getTime(): NTP server IP address 168.96.251.227
[I][ESPNtpClient.cpp:662] 259092 getTime(): Sending UDP packet
[I][ESPNtpClient.cpp:665] 259092 getTime(): Status set to REQUESTED
[I][ESPNtpClient.cpp:715] 258880 sendNTPpacket(): sendNTPpacket
[I][ESPNtpClient.cpp:736] 258880 sendNTPpacket(): Sending packet
[I][ESPNtpClient.cpp:749] 258804 sendNTPpacket(): UDP packet sent
[I][ESPNtpClient.cpp:457] 258704 s_recvPacket(): NTP Packet received from 168.96.251.227:123
[I][ESPNtpClient.cpp:892] 258784 decodeNtpMessage(): Decoded NTP message
[I][ESPNtpClient.cpp:1058] 258784 calculateOffset(): Offset: 0.000656, Delay: 0.026961
[I][ESPNtpClient.cpp:1063] 258784 calculateOffset(): Calculated offset 0.000656 sec. Delay 26.961088 ms
[I][ESPNtpClient.cpp:308] 258784 processPacket(): offset 656 -- sum 656 -- round 1 -- average 656
[W][ESPNtpClient.cpp:323] 258784 processPacket(): Offset under threshold. Not updating
[I][ESPNtpClient.cpp:328] 258784 processPacket(): Offset 0.656 ms is under threshold 2500. Not updating
@tatuiot
Copy link
Author

tatuiot commented Nov 11, 2021

Hi, I managed to fix it using the following statement
NTP.setTimeZone(TZ_Etc_GMTm3);
there must be some kind of bug there because Buenos Aires time adds 3 hrs to GMT time and it should be -3.

@gmag11
Copy link
Owner

gmag11 commented Nov 22, 2021

Encoding for Buenos Aires time is #define TZ_America_Argentina_Buenos_Aires PSTR("<-03>3"). I've found no reference for this format but https://developer.ibm.com/articles/au-aix-posix/ Notation using <> is not described there so maybe it is a mistake.

As Argentina does not have DST you can use GMT-3.

@gmag11 gmag11 added the bug Something isn't working label Nov 22, 2021
@gmag11
Copy link
Owner

gmag11 commented Dec 25, 2021

I've added an issue in ESP8266 Arduino core repository: esp8266/Arduino#8423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants