update BootProgressLastUpdate when BootProgress is set
Per the boot-progress.md[1] design document, the BootProgressLastUpdate
property should be updated with the current time since epoch in
microseconds whenever the BootProgress property is updated.
Tested:
- Confirmed that when BootProgress is updated, the
BootProgressLastUpdate was updated with the correct time
[1]: https://github.com/openbmc/docs/blob/master/designs/boot-progress.md
Change-Id: I96bc1b03441e14dbb23bb5d175fc480fa25a1d52
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/host_state_manager.cpp b/host_state_manager.cpp
index ac9181d..7637816 100644
--- a/host_state_manager.cpp
+++ b/host_state_manager.cpp
@@ -20,6 +20,7 @@
#include <xyz/openbmc_project/Control/Power/RestorePolicy/server.hpp>
#include <xyz/openbmc_project/State/Host/error.hpp>
+#include <chrono>
#include <filesystem>
#include <format>
#include <fstream>
@@ -450,6 +451,19 @@
Host::ProgressStages Host::bootProgress(ProgressStages value)
{
auto retVal = bootprogress::Progress::bootProgress(value);
+
+ // Update the BootProgressLastUpdate anytime BootProgress is updated
+ auto timeStamp = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::system_clock::now().time_since_epoch())
+ .count();
+ this->bootProgressLastUpdate(timeStamp);
+ serialize();
+ return retVal;
+}
+
+uint64_t Host::bootProgressLastUpdate(uint64_t value)
+{
+ auto retVal = bootprogress::Progress::bootProgressLastUpdate(value);
serialize();
return retVal;
}