Icinga DB Check: replace nested calls to fmax() with std::max()

Improves readability, even more so after splitting it into separate lines.
This commit is contained in:
Julian Brost 2022-06-24 15:06:14 +02:00 committed by Julian Brost
parent f3f1373f83
commit 5613412b81
1 changed files with 5 additions and 1 deletions

View File

@ -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)