From 2fc33996b620d97e54d75b0d8c101fb3d9ba791c Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 16 Jan 2019 17:27:38 +0100 Subject: [PATCH] Log: Ensure not to pass negative values to localtime() refs #6887 --- lib/icinga/checkable-check.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index e70648d89..f8b1d1ff7 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -82,10 +82,11 @@ void Checkable::UpdateNextCheck(const MessageOrigin::Ptr& origin) adj = std::min(0.5 + fmod(GetSchedulingOffset(), interval * 5) / 100.0, adj); double nextCheck = now - adj + interval; + double lastCheck = GetLastCheck(); Log(LogDebug, "Checkable") << "Update checkable '" << GetName() << "' with check interval '" << GetCheckInterval() - << "' from last check time at " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", GetLastCheck()) + << "' from last check time at " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", (lastCheck < 0 ? 0 : lastCheck)) << " (" << GetLastCheck() << ") to next check time at " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", nextCheck) << "(" << nextCheck << ")."; SetNextCheck(nextCheck, false, origin);