summaryrefslogtreecommitdiffstats
path: root/app/configuration/controllers/date-time-controller.js
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2018-09-27 10:07:17 -0500
committerGunnar Mills <gmills@us.ibm.com>2018-10-09 00:42:39 +0000
commiteab3213c291c61209a3dbdba8d4e7708e60c7161 (patch)
tree71aece0616b11eb9c0a4cd8de7d59bf96aaa2975 /app/configuration/controllers/date-time-controller.js
parentf378c772cfeef5cf40679307db1807622a0aaa4e (diff)
downloadphosphor-webui-eab3213c291c61209a3dbdba8d4e7708e60c7161.tar.gz
phosphor-webui-eab3213c291c61209a3dbdba8d4e7708e60c7161.zip
Set Host Time from correct fields
In all cases except when the time owner is "Split", Host and BMC time share fields. Make sure to set the Host time from the correct fields, which is these shared fields in all cases except when time owner is "Split". Resolves openbmc/phosphor-webui#20 Tested: Able to set the Host and BMC time Change-Id: I69985fd2de08fe71c62fd57dd1fa872f7f33ba09 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'app/configuration/controllers/date-time-controller.js')
-rw-r--r--app/configuration/controllers/date-time-controller.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/app/configuration/controllers/date-time-controller.js b/app/configuration/controllers/date-time-controller.js
index c5a3e8b..0f6ecf9 100644
--- a/app/configuration/controllers/date-time-controller.js
+++ b/app/configuration/controllers/date-time-controller.js
@@ -13,6 +13,7 @@ window.angular && (function(angular) {
'$scope', '$window', 'APIUtils', '$route', '$q',
function($scope, $window, APIUtils, $route, $q) {
$scope.bmc = {};
+ // Only used when the owner is "Split"
$scope.host = {};
$scope.ntp = {servers: []};
$scope.time_mode = '';
@@ -98,16 +99,22 @@ window.angular && (function(angular) {
// Else set BMC only. See:
// https://github.com/openbmc/phosphor-time-manager/blob/master/README.md
if ($scope.time_owner != 'Host') {
- manual_promises.push(setBMCTime());
+ manual_promises.push(
+ setBMCTime($scope.bmc.date.getTime() * 1000));
}
-
+ // Even though we are setting Host time, we are setting from
+ // the BMC date and time fields labeled "BMC and Host Time"
+ // currently.
if ($scope.time_owner == 'Host') {
- manual_promises.push(setHostTime());
+ manual_promises.push(
+ setHostTime($scope.bmc.date.getTime() * 1000));
}
}
- // Set the Host if Split even if NTP.
+ // Set the Host if Split even if NTP. In split mode, the host has
+ // its own date and time field. Set from it.
if ($scope.time_owner == 'Split') {
- manual_promises.push(setHostTime());
+ manual_promises.push(
+ setHostTime($scope.host.date.getTime() * 1000));
}
$q.all(manual_promises)
@@ -165,16 +172,16 @@ window.angular && (function(angular) {
'xyz.openbmc_project.Time.Owner.Owners.' + $scope.time_owner);
}
- function setBMCTime() {
+ function setBMCTime(time) {
// Add the separate date and time objects and convert to Epoch time in
// microseconds.
- return APIUtils.setBMCTime($scope.bmc.date.getTime() * 1000);
+ return APIUtils.setBMCTime(time);
}
- function setHostTime() {
+ function setHostTime(time) {
// Add the separate date and time objects and convert to Epoch time
// microseconds.
- return APIUtils.setHostTime($scope.host.date.getTime() * 1000);
+ return APIUtils.setHostTime(time);
}
}
]);
OpenPOWER on IntegriCloud