added timestamp in ISO-8601 format
This commit is contained in:
parent
f48de3aa15
commit
b1311d8494
|
|
@ -113,6 +113,7 @@ void PrintNetifs(void);
|
||||||
void GotEthIF(void);
|
void GotEthIF(void);
|
||||||
|
|
||||||
void GetRFC3339Time(char *t);
|
void GetRFC3339Time(char *t);
|
||||||
|
void GetISO8601Time(char *t);
|
||||||
void StartTimeGet(void);
|
void StartTimeGet(void);
|
||||||
|
|
||||||
esp_err_t StartOTA(bool isManual);
|
esp_err_t StartOTA(bool isManual);
|
||||||
|
|
|
||||||
15
src/SNTP.c
15
src/SNTP.c
|
|
@ -113,6 +113,21 @@ void GetRFC3339Time(char *t)
|
||||||
timeinfo.tm_sec);
|
timeinfo.tm_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetISO8601Time(char *t)
|
||||||
|
{
|
||||||
|
struct tm timeinfo;
|
||||||
|
struct timeval tp;
|
||||||
|
gettimeofday(&tp, NULL);
|
||||||
|
localtime_r(&tp.tv_sec, &timeinfo);
|
||||||
|
sprintf(t, "%04d-%02d-%02dT%02d:%02d:%02d.%luZ",
|
||||||
|
(timeinfo.tm_year) + YEAR_BASE,
|
||||||
|
(timeinfo.tm_mon) + 1,
|
||||||
|
timeinfo.tm_mday,
|
||||||
|
timeinfo.tm_hour,
|
||||||
|
timeinfo.tm_min,
|
||||||
|
timeinfo.tm_sec, (unsigned long)tp.tv_usec);
|
||||||
|
}
|
||||||
|
|
||||||
void StartSystemTimer(void)
|
void StartSystemTimer(void)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(esp_timer_create(&system_seconds_timer_args, &system_seconds_timer));
|
ESP_ERROR_CHECK(esp_timer_create(&system_seconds_timer_args, &system_seconds_timer));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user