1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-25 20:02:37 +03:00

SNTP: backport espressif sntp api for lwip2 (#7097)

This commit is contained in:
david gauchard 2020-02-22 11:55:01 +01:00 committed by GitHub
parent e6decacd0a
commit f69e404c87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,13 +78,31 @@ int clock_gettime(clockid_t unused, struct timespec *tp)
#define sntp_real_timestamp sntp_get_current_timestamp()
#endif
#if LWIP_VERSION_MAJOR == 2
// backport api
#if LWIP_VERSION_MAJOR != 1
// backport Espressif api
bool sntp_set_timezone_in_seconds (int32_t timezone_sec)
{
configTime(timezone_sec, 0, sntp_getservername(0), sntp_getservername(1), sntp_getservername(2));
return true;
}
bool sntp_set_timezone(sint8 timezone_in_hours)
{
return sntp_set_timezone_in_seconds(3600 * ((int)timezone_in_hours));
}
char* sntp_get_real_time(time_t t)
{
return ctime(&t);
}
uint32 sntp_get_current_timestamp()
{
return sntp_real_timestamp;
}
#endif
time_t time(time_t * t)