Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d208a36

Browse filesBrowse files
Lucme-no-dev
Luc
authored andcommitted
Use correct sign of offset for TZ variable (espressif#685)
Use UTC instead of CDT for consistency
1 parent a20f94c commit d208a36
Copy full SHA for d208a36

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed

‎cores/esp32/esp32-hal-time.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-time.c
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818
static void setTimeZone(long offset, int daylight)
1919
{
2020
char cst[16] = {0};
21-
char cdt[16] = "CDT";
21+
char cdt[16] = "DST";
2222
char tz[32] = {0};
2323

2424
if(offset % 3600){
25-
sprintf(cst, "CST%ld:%02u:%02u", offset / 3600, abs((offset % 3600) / 60), abs(offset % 60));
25+
sprintf(cst, "UTC%ld:%02u:%02u", offset / 3600, abs((offset % 3600) / 60), abs(offset % 60));
2626
} else {
27-
sprintf(cst, "CST%ld", offset / 3600);
27+
sprintf(cst, "UTC%ld", offset / 3600);
2828
}
2929
if(daylight != 3600){
3030
long tz_dst = offset - daylight;
3131
if(tz_dst % 3600){
32-
sprintf(cdt, "CDT%ld:%02u:%02u", tz_dst / 3600, abs((tz_dst % 3600) / 60), abs(tz_dst % 60));
32+
sprintf(cdt, "DST%ld:%02u:%02u", tz_dst / 3600, abs((tz_dst % 3600) / 60), abs(tz_dst % 60));
3333
} else {
34-
sprintf(cdt, "CDT%ld", tz_dst / 3600);
34+
sprintf(cdt, "DST%ld", tz_dst / 3600);
3535
}
3636
}
3737
sprintf(tz, "%s%s", cst, cdt);
@@ -53,7 +53,7 @@ void configTime(long gmtOffset_sec, int daylightOffset_sec, const char* server1,
5353
sntp_setservername(1, (char*)server2);
5454
sntp_setservername(2, (char*)server3);
5555
sntp_init();
56-
setTimeZone(gmtOffset_sec, daylightOffset_sec);
56+
setTimeZone(-gmtOffset_sec, daylightOffset_sec);
5757
}
5858

5959
/*

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.