Remove TimeOwner Feature
The TimeOwner feature is confusing from feedback from the community and
hence removing the feature.
Remove the TimeOwner feature in the phosphor-time-manager repo and
needed settings objects.
Tested: Manually set the date time on the web and successfully update
the date time of BMC (eg: 2020/01/01 08:07:50).
busctrl get-property xyz.openbmc_project.Time.Manager
/xyz/openbmc_project/time/bmc
xyz.openbmc_project.Time.EpochTime Elapsed
t 1577837156385836
Refer: https://lists.ozlabs.org/pipermail/openbmc/2020-April/021409.html
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Id47eb0a03e0e94eeff29d2b77dccefb89cded7b8
diff --git a/bmc_epoch.cpp b/bmc_epoch.cpp
index d000a71..9c8affc 100644
--- a/bmc_epoch.cpp
+++ b/bmc_epoch.cpp
@@ -9,7 +9,6 @@
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
-#include <xyz/openbmc_project/Time/error.hpp>
// Need to do this since its not exported outside of the kernel.
// Refer : https://gist.github.com/lethean/446cea944b7441228298
@@ -27,9 +26,6 @@
namespace server = sdbusplus::xyz::openbmc_project::Time::server;
using namespace phosphor::logging;
-using NotAllowedError =
- sdbusplus::xyz::openbmc_project::Time::Error::NotAllowed;
-
BmcEpoch::BmcEpoch(sdbusplus::bus::bus& bus, const char* objPath) :
EpochBase(bus, objPath), bus(bus)
{
@@ -84,63 +80,27 @@
uint64_t BmcEpoch::elapsed() const
{
- // It does not needs to check owner when getting time
return getTime().count();
}
uint64_t BmcEpoch::elapsed(uint64_t value)
{
/*
- Mode | Owner | Set BMC Time
- ----- | ----- | -------------
- NTP | BMC | Fail to set
- NTP | HOST | Not allowed
- NTP | SPLIT | Fail to set
- NTP | BOTH | Fail to set
- MANUAL| BMC | OK
- MANUAL| HOST | Not allowed
- MANUAL| SPLIT | OK
- MANUAL| BOTH | OK
+ Mode | Set BMC Time
+ ----- | -------------
+ NTP | Fail to set
+ MANUAL| OK
*/
- if (timeOwner == Owner::Host)
- {
- using namespace xyz::openbmc_project::Time;
- elog<NotAllowedError>(
- NotAllowed::OWNER(utils::ownerToStr(timeOwner).c_str()),
- NotAllowed::SYNC_METHOD(utils::modeToStr(timeMode).c_str()),
- NotAllowed::REASON(
- "Setting BmcTime with HOST owner is not allowed"));
- }
-
auto time = microseconds(value);
- if (setTime(time))
- {
- notifyBmcTimeChange(time);
- }
+ setTime(time);
server::EpochTime::elapsed(value);
return value;
}
-void BmcEpoch::setBmcTimeChangeListener(BmcTimeChangeListener* listener)
-{
- timeChangeListener = listener;
-}
-
-void BmcEpoch::notifyBmcTimeChange(const microseconds& time)
-{
- // Notify listener if it exists
- if (timeChangeListener)
- {
- timeChangeListener->onBmcTimeChanged(time);
- }
-}
-
int BmcEpoch::onTimeChange(sd_event_source* es, int fd, uint32_t /* revents */,
void* userdata)
{
- auto bmcEpoch = static_cast<BmcEpoch*>(userdata);
-
std::array<char, 64> time{};
// We are not interested in the data here.
@@ -148,9 +108,6 @@
while (read(fd, time.data(), time.max_size()) > 0)
;
- log<level::INFO>("BMC system time is changed");
- bmcEpoch->notifyBmcTimeChange(bmcEpoch->getTime());
-
return 0;
}