Detect if NTP is active on native (#8962)

* Detect if NTP is active on native

* Drop debug warning
This commit is contained in:
Jonathan Bennett
2025-12-16 20:40:29 -06:00
committed by GitHub
parent 203826374c
commit f1aefc4eef

View File

@@ -428,10 +428,17 @@ void setup()
#endif
#if ARCH_PORTDUINO
RTCQuality ourQuality = RTCQualityDevice;
std::string timeCommandResult = exec("timedatectl status | grep synchronized | grep yes -c");
if (timeCommandResult[0] == '1') {
ourQuality = RTCQualityNTP;
}
struct timeval tv;
tv.tv_sec = time(NULL);
tv.tv_usec = 0;
perhapsSetRTC(RTCQualityDevice, &tv);
perhapsSetRTC(ourQuality, &tv);
#endif
powerMonInit();