added SetSystemTime() function
This commit is contained in:
parent
3a7bf2a635
commit
78dbc8e917
|
|
@ -117,6 +117,7 @@ void GotEthIF(void);
|
||||||
void GetRFC3339Time(char *t);
|
void GetRFC3339Time(char *t);
|
||||||
void GetISO8601Time(char *t);
|
void GetISO8601Time(char *t);
|
||||||
void StartTimeGet(void);
|
void StartTimeGet(void);
|
||||||
|
void SetSystemTime(struct tm *time, const char* source);
|
||||||
|
|
||||||
esp_err_t StartOTA(bool isManual);
|
esp_err_t StartOTA(bool isManual);
|
||||||
char* GetAvailVersion();
|
char* GetAvailVersion();
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,14 @@ void StartSystemTimer(void)
|
||||||
ESP_ERROR_CHECK(esp_timer_start_periodic(system_seconds_timer, 1000000));
|
ESP_ERROR_CHECK(esp_timer_start_periodic(system_seconds_timer, 1000000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetSystemTime(struct tm *time, const char* source)
|
||||||
|
{
|
||||||
|
time_t t = mktime(time);
|
||||||
|
ESP_LOGI("SNTP","Setting time: %s from thq source %s", asctime(time), source);
|
||||||
|
struct timeval now = { .tv_sec = t };
|
||||||
|
settimeofday(&now, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void SecondTickSystem(void *param)
|
void SecondTickSystem(void *param)
|
||||||
{
|
{
|
||||||
++UpTime;
|
++UpTime;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user