Skip to content
Snippets Groups Projects
Commit e47530ff authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

sys_timezone() no longer modifies the scfg_t.sys_timezone member itself

... just the returned copy (when toggling the DST flag).

This resolve the issue of SCFG->System menu detecting changes by the sysop
(and prompting to Save Changes when exiting) when no changes were actually
made, just that DST had been auto-enabled/disabled based on the date.
parent 3cd0394c
No related branches found
No related tags found
No related merge requests found
......@@ -535,11 +535,14 @@ char* prep_code(char *str, const char* prefix)
/****************************************************************************/
/* Auto-toggle daylight savings time in US time-zones */
/* or return auto-detected local timezone as an offset from UTC. */
/* Does not modify cfg->sys_timezone itself, just the returned copy. */
/****************************************************************************/
ushort sys_timezone(scfg_t* cfg)
{
time_t now;
struct tm tm;
int16_t sys_timezone = cfg->sys_timezone;
if (cfg->sys_timezone == SYS_TIMEZONE_AUTO)
return xpTimeZone_local();
......@@ -548,13 +551,13 @@ ushort sys_timezone(scfg_t* cfg)
now = time(NULL);
if (localtime_r(&now, &tm) != NULL) {
if (tm.tm_isdst > 0)
cfg->sys_timezone |= DAYLIGHT;
sys_timezone |= DAYLIGHT;
else if (tm.tm_isdst == 0)
cfg->sys_timezone &= ~DAYLIGHT;
sys_timezone &= ~DAYLIGHT;
}
}
return cfg->sys_timezone;
return sys_timezone;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment