summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2017-08-01 17:37:41 +0800
committerLei YU <mine260309@gmail.com>2017-10-16 20:41:02 +0800
commit1c2ce82c0c3226a94aeefcc6ff2ddee170792ca0 (patch)
treedf1cb57ae4163150edf122b198fc8a5c56e69252
parent710d49be2fc33f22e8f4a7ed43774fd9293d083f (diff)
downloadphosphor-time-manager-1c2ce82c0c3226a94aeefcc6ff2ddee170792ca0.tar.gz
phosphor-time-manager-1c2ce82c0c3226a94aeefcc6ff2ddee170792ca0.zip
Let timedate1 to decide on setting time in NTP mode
In NTP mode, let timedate1 to set BMC time, for now, it results in error. Change-Id: I2d78cdcfe6868642f43198dd932b20b13fd8523d Signed-off-by: Lei YU <mine260309@gmail.com>
-rw-r--r--README.md6
-rw-r--r--bmc_epoch.cpp12
-rw-r--r--epoch_base.cpp6
-rw-r--r--test/TestBmcEpoch.cpp6
4 files changed, 12 insertions, 18 deletions
diff --git a/README.md b/README.md
index 5365349..cf7a287 100644
--- a/README.md
+++ b/README.md
@@ -51,10 +51,10 @@ allowed depending on below two settings in settings manager.
A summary of which cases the time can be set on BMC or HOST:
Mode | Owner | Set BMC Time | Set Host Time
--------- | ----- | ------------- | -------------------
-NTP | BMC | Not allowed | Not allowed
+NTP | BMC | Fail to set | Not allowed
NTP | HOST | Not allowed | Not allowed
-NTP | SPLIT | Not allowed | OK
-NTP | BOTH | Not allowed | Not allowed
+NTP | SPLIT | Fail to set | OK
+NTP | BOTH | Fail to set | Not allowed
MANUAL | BMC | OK | Not allowed
MANUAL | HOST | Not allowed | OK
MANUAL | SPLIT | OK | OK
diff --git a/bmc_epoch.cpp b/bmc_epoch.cpp
index 4c8bf60..bb3872b 100644
--- a/bmc_epoch.cpp
+++ b/bmc_epoch.cpp
@@ -95,21 +95,15 @@ uint64_t BmcEpoch::elapsed(uint64_t value)
/*
Mode | Owner | Set BMC Time
----- | ----- | -------------
- NTP | BMC | Not allowed
+ NTP | BMC | Fail to set
NTP | HOST | Not allowed
- NTP | SPLIT | Not allowed
- NTP | BOTH | 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
*/
- if (timeMode == Mode::NTP)
- {
- log<level::ERR>("Setting BmcTime with NTP mode is not allowed");
- // TODO: throw NotAllowed exception
- return 0;
- }
if (timeOwner == Owner::Host)
{
log<level::ERR>("Setting BmcTime with HOST owner is not allowed");
diff --git a/epoch_base.cpp b/epoch_base.cpp
index 09337de..dc21c67 100644
--- a/epoch_base.cpp
+++ b/epoch_base.cpp
@@ -47,7 +47,11 @@ void EpochBase::setTime(const microseconds& usec)
method.append(static_cast<int64_t>(usec.count()),
false, // relative
false); // user_interaction
- bus.call_noreply(method);
+ auto reply = bus.call(method);
+ if (reply.is_method_error())
+ {
+ log<level::ERR>("Error in setting system time");
+ }
}
microseconds EpochBase::getTime() const
diff --git a/test/TestBmcEpoch.cpp b/test/TestBmcEpoch.cpp
index e268b9f..32592e6 100644
--- a/test/TestBmcEpoch.cpp
+++ b/test/TestBmcEpoch.cpp
@@ -82,17 +82,13 @@ TEST_F(TestBmcEpoch, getElapsed)
TEST_F(TestBmcEpoch, setElapsedNotAllowed)
{
- setTimeMode(Mode::NTP);
auto epochNow = duration_cast<microseconds>(
system_clock::now().time_since_epoch()).count();
- // In NTP mode, setting time is not allowed
- auto ret = bmcEpoch->elapsed(epochNow);
- EXPECT_EQ(0, ret);
// In Host owner, setting time is not allowed
setTimeMode(Mode::Manual);
setTimeOwner(Owner::Host);
- ret = bmcEpoch->elapsed(epochNow);
+ auto ret = bmcEpoch->elapsed(epochNow);
EXPECT_EQ(0, ret);
}
OpenPOWER on IntegriCloud