Use correct sign of offset for TZ variable (#685)
Use UTC instead of CDT for consistency
This commit is contained in:
parent
a20f94ce62
commit
d208a36836
@ -18,20 +18,20 @@
|
|||||||
static void setTimeZone(long offset, int daylight)
|
static void setTimeZone(long offset, int daylight)
|
||||||
{
|
{
|
||||||
char cst[16] = {0};
|
char cst[16] = {0};
|
||||||
char cdt[16] = "CDT";
|
char cdt[16] = "DST";
|
||||||
char tz[32] = {0};
|
char tz[32] = {0};
|
||||||
|
|
||||||
if(offset % 3600){
|
if(offset % 3600){
|
||||||
sprintf(cst, "CST%ld:%02u:%02u", offset / 3600, abs((offset % 3600) / 60), abs(offset % 60));
|
sprintf(cst, "UTC%ld:%02u:%02u", offset / 3600, abs((offset % 3600) / 60), abs(offset % 60));
|
||||||
} else {
|
} else {
|
||||||
sprintf(cst, "CST%ld", offset / 3600);
|
sprintf(cst, "UTC%ld", offset / 3600);
|
||||||
}
|
}
|
||||||
if(daylight != 3600){
|
if(daylight != 3600){
|
||||||
long tz_dst = offset - daylight;
|
long tz_dst = offset - daylight;
|
||||||
if(tz_dst % 3600){
|
if(tz_dst % 3600){
|
||||||
sprintf(cdt, "CDT%ld:%02u:%02u", tz_dst / 3600, abs((tz_dst % 3600) / 60), abs(tz_dst % 60));
|
sprintf(cdt, "DST%ld:%02u:%02u", tz_dst / 3600, abs((tz_dst % 3600) / 60), abs(tz_dst % 60));
|
||||||
} else {
|
} else {
|
||||||
sprintf(cdt, "CDT%ld", tz_dst / 3600);
|
sprintf(cdt, "DST%ld", tz_dst / 3600);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf(tz, "%s%s", cst, cdt);
|
sprintf(tz, "%s%s", cst, cdt);
|
||||||
@ -53,7 +53,7 @@ void configTime(long gmtOffset_sec, int daylightOffset_sec, const char* server1,
|
|||||||
sntp_setservername(1, (char*)server2);
|
sntp_setservername(1, (char*)server2);
|
||||||
sntp_setservername(2, (char*)server3);
|
sntp_setservername(2, (char*)server3);
|
||||||
sntp_init();
|
sntp_init();
|
||||||
setTimeZone(gmtOffset_sec, daylightOffset_sec);
|
setTimeZone(-gmtOffset_sec, daylightOffset_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user