From 460083c28fc6482a116f97c0441b5f66d49281b5 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Tue, 4 Feb 2020 19:56:43 +0300 Subject: [PATCH] Show pretty uptime with NTP_SUPPORT (#2137) Fallback to basic N seconds display when disabled --- code/espurna/utils.ino | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/code/espurna/utils.ino b/code/espurna/utils.ino index c1fe6798..c07a9867 100644 --- a/code/espurna/utils.ino +++ b/code/espurna/utils.ino @@ -208,12 +208,16 @@ namespace Heartbeat { } void infoUptime() { - auto uptime [[gnu::unused]] = getUptime(); - DEBUG_MSG_P( - PSTR("Uptime: %02dd %02dh %02dm %02ds\n"), - elapsedDays(uptime), numberOfHours(uptime), - numberOfMinutes(uptime), numberOfSeconds(uptime) - ); + const auto uptime [[gnu::unused]] = getUptime(); + #if NTP_SUPPORT + DEBUG_MSG_P( + PSTR("[MAIN] Uptime: %02dd %02dh %02dm %02ds\n"), + elapsedDays(uptime), numberOfHours(uptime), + numberOfMinutes(uptime), numberOfSeconds(uptime) + ); + #else + DEBUG_MSG_P(PSTR("[MAIN] Uptime: %lu seconds\n"), uptime); + #endif // NTP_SUPPORT } void heartbeat() {