mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 10:42:49 +00:00
Detect if NTP is active on native (#8962)
* Detect if NTP is active on native * Drop debug warning
This commit is contained in:
@@ -428,10 +428,17 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ARCH_PORTDUINO
|
#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;
|
struct timeval tv;
|
||||||
tv.tv_sec = time(NULL);
|
tv.tv_sec = time(NULL);
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
perhapsSetRTC(RTCQualityDevice, &tv);
|
perhapsSetRTC(ourQuality, &tv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
powerMonInit();
|
powerMonInit();
|
||||||
|
|||||||
Reference in New Issue
Block a user