summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp
diff options
context:
space:
mode:
authorjmbills <jason.m.bills@intel.com>2021-08-03 01:45:08 +0300
committerGitHub <noreply@github.com>2021-08-03 01:45:08 +0300
commit10ad77d5bc86709d8ff7f95e7040e39f1c153903 (patch)
tree307cedb87f4c0a329740c55ac364ed489d1d8fc2 /meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp
parentc6b1c6ba7a01b7987d65d61c262c44c320193108 (diff)
parent67327ddc580cb9a85219a534844832a1682780d4 (diff)
downloadopenbmc-10ad77d5bc86709d8ff7f95e7040e39f1c153903.tar.xz
Merge pull request #69 from Intel-BMC/update2021-0.631-0.63
Update
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp
index 00e2b53fe..454bdc1db 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp
@@ -13,6 +13,7 @@
* limitations under the License.
*/
+#include <systemd/sd-journal.h>
#include <time.h>
#include <boost/asio/io_service.hpp>
@@ -323,9 +324,22 @@ class PCHSync
{
return false;
}
- phosphor::logging::log<phosphor::logging::level::INFO>(
- "Update BMC time to: ",
- phosphor::logging::entry("TIME=%s", dateString.c_str()));
+ char newDateString[32] = {0};
+ strftime(newDateString, sizeof(newDateString), "%F %T",
+ gmtime(&PCHTimeSeconds));
+
+ struct tm* timeinfo;
+ char oldDateString[32] = {0};
+ timeinfo = gmtime(&BMCTimeSeconds);
+ strftime(oldDateString, sizeof(oldDateString), "%F %T", timeinfo);
+
+ // Log event about BMC time update via PCH
+ sd_journal_send(
+ "MESSAGE=BMC time updated via PCH: New time=%s, Old time=%s",
+ newDateString, oldDateString, "PRIORITY=%i", LOG_INFO,
+ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.BMCTimeUpdatedViaHost",
+ "REDFISH_MESSAGE_ARGS=%s,%s", newDateString, oldDateString,
+ NULL);
}
// During the boot time, systemd-timesyncd.service checks