Added thread lock around timezone update function
This commit is contained in:
parent
5fb09f67d6
commit
d72d11c200
1 changed files with 2 additions and 0 deletions
|
@ -49,12 +49,14 @@ void sntp_init(void);
|
|||
// Sets time zone.
|
||||
// NOTE: Settings do not take effect until SNTP time is updated.
|
||||
void sntp_set_timezone(const struct timezone *tz) {
|
||||
xSemaphoreTake(sntp_sem, portMAX_DELAY);
|
||||
if (tz) {
|
||||
stz = *tz;
|
||||
} else {
|
||||
stz.tz_minuteswest = 0;
|
||||
stz.tz_dsttime = 0;
|
||||
}
|
||||
xSemaphoreGive(sntp_sem);
|
||||
}
|
||||
|
||||
// Initialization
|
||||
|
|
Loading…
Reference in a new issue