]> granicus.if.org Git - icinga2/commitdiff
Merge pull request #6899 from Icinga/bugfix/localtime-zero-windows
authorMichael Friedrich <michael.friedrich@icinga.com>
Thu, 24 Jan 2019 09:58:43 +0000 (10:58 +0100)
committerGitHub <noreply@github.com>
Thu, 24 Jan 2019 09:58:43 +0000 (10:58 +0100)
Log: Ensure not to pass negative values to localtime()

1  2 
lib/icinga/checkable-check.cpp

index b159247a9aac96a5ca6aee9f328cb9308b7365ad,f8b1d1ff7eec0eb7b11b71ad34684db7fa758039..0b8917b77e8e77c6cbff6cd3075d37fce05f4c5b
@@@ -79,10 -79,10 +79,11 @@@ void Checkable::UpdateNextCheck(const M
        if (interval > 1)
                adj = fmod(now * 100 + GetSchedulingOffset(), interval * 100) / 100.0;
  
 -      adj = std::min(0.5 + fmod(GetSchedulingOffset(), interval * 5) / 100.0, adj);
 +      if (adj != 0.0)
 +              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()