From e8c517f650b83ecb37a8763619d78cad9c11984a Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Tue, 29 Nov 2022 22:55:14 +0100 Subject: [PATCH] Fix timezone specific issue when syncing time manually Time was off by one hour when using the sync button in the web UI. tm_isdst = -1 means that mktime determines the DST flag based on the current timezone --- src/WebApi_ntp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/WebApi_ntp.cpp b/src/WebApi_ntp.cpp index a2d1e9361..4c3715473 100644 --- a/src/WebApi_ntp.cpp +++ b/src/WebApi_ntp.cpp @@ -277,6 +277,7 @@ void WebApiNtpClass::onNtpTimePost(AsyncWebServerRequest* request) local.tm_mday = root[F("day")].as(); // day of the month - [ 1 to 31 ] local.tm_mon = root[F("month")].as() - 1; // months since January - [ 0 to 11 ] local.tm_year = root[F("year")].as() - 1900; // years since 1900 + local.tm_isdst = -1; time_t t = mktime(&local); struct timeval now = { .tv_sec = t, .tv_usec = 0 };