sntp_time.h
Functions
-
void lwip_sntp_set_time(uint32_t seconds)
-
void lwip_sntp_reset_flag(void)
-
bool lwip_sntp_time_was_set(void)
-
uint32_t lwip_sntp_get_unix_time(void)
Get current Unix timestamp from RTC.
- Returns:
Current time as Unix timestamp (seconds since Jan 1, 1970) Returns 0 if time has not been set via SNTP
-
uint32_t lwip_sntp_read_rtc_raw(void)
Read the RTC’s current value as a Unix timestamp, regardless of whether it was ever set via SNTP.
Unlike lwip_sntp_get_unix_time(), this does not gate on lwip_sntp_time_was_set() – it reports whatever the hardware clock currently holds (e.g. a user-set OS clock, a value left over from a prior session, or the post-RAM-clear default), is not timezone/DST-adjusted (raw local RTC reading), and is used to decide whether the clock looks plausible at all.
- Returns:
Current RTC reading as Unix-seconds-shaped value.
-
void lwip_sntp_clamp_rtc_floor(uint32_t floor_unix_seconds)
Write seconds/minutes/hours/day/month/year (RTC component form, same conversion lwip_sntp_set_time() uses) directly to the RTC, without touching the SNTP-set flag.
Used to clamp a clearly-wrong RTC forward to a known-sane floor (e.g. the library’s release date) so timestamp-based checks elsewhere – certificate expiry, ticket aging – aren’t silently defeated by a post-RAM-clear clock reading 1970/0.
- Parameters:
seconds – Unix timestamp (UTC) to write into the RTC.