mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 00:18:11 +01:00
Fix time component for host platform (#6118)
This commit is contained in:
parent
8267b3274c
commit
2283b3b443
1 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,10 @@
|
|||
#include "real_time_clock.h"
|
||||
#include "esphome/core/log.h"
|
||||
#ifdef USE_HOST
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include "lwip/opt.h"
|
||||
#endif
|
||||
#ifdef USE_ESP8266
|
||||
#include "sys/time.h"
|
||||
#endif
|
||||
|
@ -25,7 +29,7 @@ void RealTimeClock::synchronize_epoch_(uint32_t epoch) {
|
|||
.tv_sec = static_cast<time_t>(epoch), .tv_usec = 0,
|
||||
};
|
||||
ESP_LOGVV(TAG, "Got epoch %" PRIu32, epoch);
|
||||
timezone tz = {0, 0};
|
||||
struct timezone tz = {0, 0};
|
||||
int ret = settimeofday(&timev, &tz);
|
||||
if (ret == EINVAL) {
|
||||
// Some ESP8266 frameworks abort when timezone parameter is not NULL
|
||||
|
|
Loading…
Reference in a new issue