ntp: simplify uptime info, drop legacy timelib funcs & consts

This commit is contained in:
Maxim Prokhorov
2021-01-04 05:18:24 +03:00
parent c100696f7b
commit 83edf629cc
3 changed files with 20 additions and 79 deletions

View File

@@ -284,16 +284,19 @@ namespace Heartbeat {
}
void infoUptime() {
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
#if NTP_SUPPORT
time_t uptime = getUptime();
tm spec;
gmtime_r(&uptime, &spec);
DEBUG_MSG_P(
PSTR("[MAIN] Uptime: %02dy %02dd %02dh %02dm %02ds\n"),
(spec.tm_year - 70), spec.tm_yday, spec.tm_hour,
spec.tm_min, spec.tm_sec
);
#else
DEBUG_MSG_P(PSTR("[MAIN] Uptime: %lu seconds\n"), uptime);
#endif // NTP_SUPPORT
}
void heartbeat() {