diff options
author | jmbills <jason.m.bills@intel.com> | 2021-08-03 01:45:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-03 01:45:08 +0300 |
commit | 10ad77d5bc86709d8ff7f95e7040e39f1c153903 (patch) | |
tree | 307cedb87f4c0a329740c55ac364ed489d1d8fc2 /meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp | |
parent | c6b1c6ba7a01b7987d65d61c262c44c320193108 (diff) | |
parent | 67327ddc580cb9a85219a534844832a1682780d4 (diff) | |
download | openbmc-10ad77d5bc86709d8ff7f95e7040e39f1c153903.tar.xz |
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.cpp | 20 |
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 |