]> granicus.if.org Git - icinga2/commitdiff
compat: Fix timestamps.
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 25 Jul 2013 07:45:40 +0000 (09:45 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 25 Jul 2013 07:45:40 +0000 (09:45 +0200)
components/compat/compatcomponent.cpp
lib/base/value.cpp

index f6605ad92613cda753fb2a91a51734e5e3c678b3..9f815cbefe9726ceec330e5b4ca4e9ef1d662048 100644 (file)
@@ -437,17 +437,17 @@ void CompatComponent::DumpServiceStatusAttrs(std::ostream& fp, const Service::Pt
           << "\t" << "plugin_output=" << attrs->Get("plugin_output") << "\n"
           << "\t" << "long_plugin_output=" << attrs->Get("long_plugin_output") << "\n"
           << "\t" << "performance_data=" << attrs->Get("performance_data") << "\n"
-          << "\t" << "last_check=" << attrs->Get("last_check") << "\n"
-          << "\t" << "next_check=" << attrs->Get("next_check") << "\n"
+          << "\t" << "last_check=" << static_cast<long>(attrs->Get("last_check")) << "\n"
+          << "\t" << "next_check=" << static_cast<long>(attrs->Get("next_check")) << "\n"
           << "\t" << "current_attempt=" << attrs->Get("current_attempt") << "\n"
           << "\t" << "max_attempts=" << attrs->Get("max_attempts") << "\n"
-          << "\t" << "last_state_change=" << attrs->Get("last_state_change") << "\n"
-          << "\t" << "last_hard_state_change=" << attrs->Get("last_hard_state_change") << "\n"
-          << "\t" << "last_time_ok=" << attrs->Get("last_time_ok") << "\n"
-          << "\t" << "last_time_warn=" << attrs->Get("last_time_warn") << "\n"
-          << "\t" << "last_time_critical=" << attrs->Get("last_time_critical") << "\n"
-          << "\t" << "last_time_unknown=" << attrs->Get("last_time_unknown") << "\n"
-          << "\t" << "last_update=" << attrs->Get("last_update") << "\n"
+          << "\t" << "last_state_change=" << static_cast<long>(attrs->Get("last_state_change")) << "\n"
+          << "\t" << "last_hard_state_change=" << static_cast<long>(attrs->Get("last_hard_state_change")) << "\n"
+          << "\t" << "last_time_ok=" << static_cast<long>(attrs->Get("last_time_ok")) << "\n"
+          << "\t" << "last_time_warn=" << static_cast<long>(attrs->Get("last_time_warn")) << "\n"
+          << "\t" << "last_time_critical=" << static_cast<long>(attrs->Get("last_time_critical")) << "\n"
+          << "\t" << "last_time_unknown=" << static_cast<long>(attrs->Get("last_time_unknown")) << "\n"
+          << "\t" << "last_update=" << static_cast<long>(attrs->Get("last_update")) << "\n"
           << "\t" << "notifications_enabled=" << attrs->Get("notifications_enabled") << "\n"
           << "\t" << "active_checks_enabled=" << attrs->Get("active_checks_enabled") << "\n"
           << "\t" << "passive_checks_enabled=" << attrs->Get("passive_checks_enabled") << "\n"
@@ -458,8 +458,8 @@ void CompatComponent::DumpServiceStatusAttrs(std::ostream& fp, const Service::Pt
           << "\t" << "acknowledgement_type=" << attrs->Get("acknowledgement_type") << "\n"
           << "\t" << "acknowledgement_end_time=" << attrs->Get("acknowledgement_end_time") << "\n"
           << "\t" << "scheduled_downtime_depth=" << attrs->Get("scheduled_downtime_depth") << "\n"
-          << "\t" << "last_notification=" << attrs->Get("last_notification") << "\n"
-          << "\t" << "next_notification=" << attrs->Get("next_notification") << "\n"
+          << "\t" << "last_notification=" << static_cast<long>(attrs->Get("last_notification")) << "\n"
+          << "\t" << "next_notification=" << static_cast<long>(attrs->Get("next_notification")) << "\n"
           << "\t" << "current_notification_number=" << attrs->Get("current_notification_number") << "\n";
 }
 
@@ -616,7 +616,7 @@ void CompatComponent::StatusTimerHandler(void)
        statusfp << "programstatus {" << "\n"
                 << "icinga_pid=" << Utility::GetPid() << "\n"
                 << "\t" << "daemon_mode=1" << "\n"
-                << "\t" << "program_start=" << IcingaApplication::GetInstance()->GetStartTime() << "\n"
+                << "\t" << "program_start=" << static_cast<long>(IcingaApplication::GetInstance()->GetStartTime()) << "\n"
                 << "\t" << "active_service_checks_enabled=1" << "\n"
                 << "\t" << "passive_service_checks_enabled=1" << "\n"
                 << "\t" << "active_host_checks_enabled=1" << "\n"
index 91a780820d60b9cad563ca3a7b255633567adac4..409a21e08551c28eb9ce9dc0cf468122458282ad 100644 (file)
@@ -97,6 +97,9 @@ Value::operator double(void) const
        if (value)
                return *value;
 
+       if (IsEmpty())
+               return 0;
+
        return boost::lexical_cast<double>(m_Value);
 }