Page 1 of 1

daylight saving time

Posted: Tue Nov 25, 2025 12:03 pm
by DexterM
Is available information that daylight savings is in effect?
Main device need to know this information.
I see only: +CIPSNTPTIME:Tue Nov 25 12:31:21 2025<CR><LF>
Is available any other format of data?
E.g. in other module (Quectel) is:
"2017/01/13,11:41:23+32,0"
that last value shows adjustment (0 - no adjustment, other - adjustment is in effect, etc.)

Re: daylight saving time

Posted: Tue Nov 25, 2025 6:15 pm
by lbernstone
You should keep times in UTC until the point of consumption. The timezone (and therefore the DST status) is only relevant to humans. If you are presenting it in a webpage, you should use javascript to get the client's locale. If your point of delivery is an esp32, you can use the tm_isdst value of tm to determine if DST is active, once you have set a timezone:

Code: Select all

  struct tm timeinfo;
  getLocalTime(&timeinfo);
  isDst = timeinfo.tm_isdst;

Re: daylight saving time

Posted: Wed Nov 26, 2025 12:50 pm
by DexterM
Thank You @lbernstone for answare.
Upon further consideration, ESP provides time from an SNTP server (UTC). If we configure a time zone, it's the local time (e.g., UTC+1). The LTE module, on the other hand, returns the operator's local time, which already takes into account the offset related to daylight saving. Therefore, the DST parameter is present in the time format returned by the LTE module, but it is not (and cannot be) in the time format returned by ESP (because it would always be 0). Am I understanding correctly?

Re: daylight saving time

Posted: Wed Nov 26, 2025 3:50 pm
by lbernstone
Are you sure the LTE module cannot give you UTC time? AT+CCLK? is the standard command for time. Perhaps you need to call the SNTP command once to have it retrieve the time from the network (which returns localtime), but then you can use the normal clock command for your timekeeping. If you keep everything in UTC internally until you write to a file/socket, then it will make more maintainable code, and you won't have to be translating back and forth all the time.

Re: daylight saving time

Posted: Thu Nov 27, 2025 8:00 pm
by DexterM
Sure, UTC is available in LTE module but it was more convenient in my usecase to use local time adjusted and marked with DST flag by operator.

Unfortunately after migrating from LTE to ESP had to change RTC maintenance since there was not live DST available.

This is little more complicated in my device, because there is also external, battery backuped, RTC that must be synchronised and have to be able to work (give timestamps) and shift time (DST) also without internet availability and with power off periods.
I think it was more convenient to set it with local time and then only read a stamps and realise time shifting (DST).
Thank You

Re: daylight saving time

Posted: Wed Dec 17, 2025 7:12 am
by esp-at
The AT solution does not provide a dedicated command for handling daylight saving time.
You can either convert the UTC time on the host side, or define a custom AT command to implement this functionality yourself.