From 5613412b8191c68a20da0593c799140871655c3a Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Fri, 24 Jun 2022 15:06:14 +0200 Subject: [PATCH] Icinga DB Check: replace nested calls to fmax() with std::max() Improves readability, even more so after splitting it into separate lines. --- lib/icingadb/icingadbchecktask.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/icingadb/icingadbchecktask.cpp b/lib/icingadb/icingadbchecktask.cpp index 16c611e8b..e55258546 100644 --- a/lib/icingadb/icingadbchecktask.cpp +++ b/lib/icingadb/icingadbchecktask.cpp @@ -236,7 +236,11 @@ void IcingadbCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckR const auto clockDriftWarning (5); const auto clockDriftCritical (30); - auto clockDrift (fmax(fabs(now - redisNow), fmax(fabs(redisNow - icingadbNow), fabs(icingadbNow - now)))); + auto clockDrift (std::max({ + fabs(now - redisNow), + fabs(redisNow - icingadbNow), + fabs(icingadbNow - now), + })); if (clockDrift > clockDriftCritical) { critmsgs << " Icinga 2/Redis/Icinga DB clock drift: " << Utility::FormatDuration(clockDrift)