From f1aefc4eef47c3f1f41eb2221f788b20c77ff50a Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Tue, 16 Dec 2025 20:40:29 -0600 Subject: [PATCH] Detect if NTP is active on native (#8962) * Detect if NTP is active on native * Drop debug warning --- src/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index eb6dea327..45f4eb7b5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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();