Added timepoint validator

This commit is contained in:
CommanderRedYT
2022-03-26 17:03:12 +01:00
parent 3bbc916348
commit 7664e409d4
2 changed files with 7 additions and 0 deletions

View File

@ -338,3 +338,9 @@ float float_map(float x, float in_min, float in_max, float out_min, float out_ma
return (delta * dividend + (divisor / 2.f)) / divisor + out_min;
}
bool is_valid_timestamp(espchrono::utc_clock::time_point timestamp)
{
using namespace date;
return timestamp.time_since_epoch() > sys_seconds{sys_days{1_d/January/2000}}.time_since_epoch();
}

View File

@ -80,3 +80,4 @@ inline CRGB UINT32_TO_CRGB(uint32_t color)
std::string get_wifi_security_string(wifi_auth_mode_t authMode);
float float_map(float x, float in_min, float in_max, float out_min, float out_max);
bool is_valid_timestamp(espchrono::utc_clock::time_point timestamp);