Update EspDateTime.ino

GMT and Force update
This commit is contained in:
Hamza Yeşilmen 2023-05-17 15:45:33 +03:00 committed by GitHub
parent 30552d5379
commit 99ae6c4ba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,12 +19,19 @@ void setup() {
} }
timeClient.begin(); timeClient.begin();
timeClient.setTimeOffset(10800); //GMT+3
timeClient.update(); timeClient.update();
} }
void loop() { void loop() {
timeClient.update(); timeClient.update();
/*
while(!timeClient.update()) {
timeClient.forceUpdate();
}
*/
if (timeClient.isTimeSet()) { if (timeClient.isTimeSet()) {
unsigned long epochTime = timeClient.getEpochTime(); unsigned long epochTime = timeClient.getEpochTime();
struct tm *timeinfo; struct tm *timeinfo;