From 91ecfc35cf4d25602b9d91f7a9928c6a00806db0 Mon Sep 17 00:00:00 2001 From: Noah Hilverling Date: Thu, 31 Oct 2019 13:59:16 +0100 Subject: [PATCH] Ensure that execution_time never goes below 0 --- lib/icingadb/icingadb-objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index e98713e8c..7d63bcc56 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -1616,7 +1616,7 @@ Dictionary::Ptr IcingaDB::SerializeState(const Checkable::Ptr& checkable) if (!cr->GetCommand().IsEmpty()) attrs->Set("commandline", FormatCommandLine(cr->GetCommand())); - attrs->Set("execution_time", TimestampToMilliseconds(cr->CalculateExecutionTime())); + attrs->Set("execution_time", TimestampToMilliseconds(fmax(0.0, cr->CalculateExecutionTime()))); attrs->Set("latency", TimestampToMilliseconds(cr->CalculateLatency())); attrs->Set("check_source", cr->GetCheckSource()); }