ntpsynced=$(sed '/NTP synchronized:/ { s/^[^:]*: *//; p}; d' "$temp")
uts=$(TZ=UTC date -d "$ut" +%s)
-rtcs=$(TZ=UTC date -d "$rtc" +%s)
-delta=$((uts - rtcs))
+rtcs=$(TZ=UTC date -d "$rtc" +%s 2>/dev/null || echo "N/A")
+if [ "$rtcs" != "N/A" ]; then
+ delta=$((uts - rtcs))
+fi
if [ "$SYNSTATUSONLY" -ge 1 ]; then
if [ "$ntpsynced" != "yes" ]; then
exit 1
fi
else
+ if [ "$rtcs" = "N/A" ]; then
+ echo "Warning: Cannot parse RTC $rtc."
+ exit 1
+ fi
+
if [ "$delta" -lt "-$MAX" ] ||
[ "$delta" -gt "$MAX" ]; then
echo "Warning: time desync $delta: RTC vs. system time: $rtc vs. $ut"