You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2014/02/19 02:12:41 UTC

git commit: AMBARI-4664. Replace using local time with real server time. (xiwang via yusaku)

Repository: ambari
Updated Branches:
  refs/heads/trunk 5f939c8ef -> c6e459251


AMBARI-4664. Replace using local time with real server time. (xiwang via yusaku)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c6e45925
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c6e45925
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c6e45925

Branch: refs/heads/trunk
Commit: c6e459251e6ee6c17db2facc67c0c516bd0fb730
Parents: 5f939c8
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Tue Feb 18 17:11:44 2014 -0800
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Tue Feb 18 17:11:59 2014 -0800

----------------------------------------------------------------------
 ambari-web/app/app.js                           |  4 ++-
 .../global/background_operations_controller.js  |  6 ++--
 .../controllers/global/cluster_controller.js    | 30 ++++++++++++++++++++
 .../highAvailability/progress_controller.js     |  2 +-
 .../security/security_progress_controller.js    |  2 +-
 .../app/controllers/main/apps_controller.js     |  2 +-
 ambari-web/app/controllers/wizard.js            |  2 +-
 .../wizard/stack_upgrade/step3_controller.js    |  2 +-
 .../app/controllers/wizard/step3_controller.js  |  6 ++--
 .../app/controllers/wizard/step9_controller.js  |  2 +-
 ambari-web/app/models/alert.js                  |  2 +-
 ambari-web/app/models/user.js                   |  2 +-
 ambari-web/app/routes/main.js                   |  4 ++-
 ambari-web/app/utils/ajax.js                    |  3 ++
 ambari-web/app/utils/date.js                    | 14 +++++----
 ambari-web/app/utils/helper.js                  |  9 ++++++
 ambari-web/app/utils/http_client.js             |  2 +-
 .../app/views/common/chart/linear_time.js       |  8 +++---
 .../app/views/common/configs/services_config.js |  6 ++--
 ambari-web/app/views/common/filter_view.js      |  5 +++-
 .../app/views/main/dashboard/service/hbase.js   |  4 +--
 .../app/views/main/dashboard/service/hdfs.js    |  2 +-
 .../views/main/dashboard/service/mapreduce.js   |  2 +-
 .../app/views/main/dashboard/service/yarn.js    |  2 +-
 .../dashboard/widgets/uptime_text_widget.js     |  2 +-
 ambari-web/vendor/scripts/jquery.timeago.js     |  7 ++++-
 26 files changed, 95 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index c2ac0fa..8f88ed2 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -53,6 +53,7 @@ module.exports = Em.Application.create({
     return '/stacks2/HDP/versions/' + stackVersion.replace(/HDP-/g, '');
   }.property('currentStackVersion'),
   clusterName: null,
+  clockDistance:null, // server clock - client clock
   currentStackVersion: '',
   currentStackVersionNumber: function(){
     return this.get('currentStackVersion').replace(/HDP(Local)?-/, '');
@@ -250,6 +251,7 @@ Em.View.reopen({
  * only in seconds whereas Javascript's Date needs
  * milliseconds representation.
  */
+var App = require('app');
 DS.attr.transforms.date = {
   from: function (serialized) {
     var type = typeof serialized;
@@ -261,7 +263,7 @@ DS.attr.transforms.date = {
       // The number could be seconds or milliseconds.
       // If seconds, then multiplying with 1000 should still
       // keep it below the current time.
-      if (serialized * 1000 < new Date().getTime()) {
+      if (serialized * 1000 < App.dateTime()) {
         serialized = serialized * 1000;
       }
       return new Date(serialized);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/controllers/global/background_operations_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/background_operations_controller.js b/ambari-web/app/controllers/global/background_operations_controller.js
index ec92570..6a4c12f 100644
--- a/ambari-web/app/controllers/global/background_operations_controller.js
+++ b/ambari-web/app/controllers/global/background_operations_controller.js
@@ -131,7 +131,7 @@ App.BackgroundOperationsController = Em.Controller.extend({
     }, this);
     request.set('previousTaskStatusMap', currentTaskStatusMap);
     request.set('hostsMap', hostsMap);
-    this.set('serviceTimestamp', new Date().getTime());
+    this.set('serviceTimestamp', App.dateTime());
   },
   /**
    * Update task, with uploading two additional properties: stdout and stderr
@@ -146,7 +146,7 @@ App.BackgroundOperationsController = Em.Controller.extend({
     task.Tasks.status = data.Tasks.status;
     task.Tasks.stdout = data.Tasks.stdout;
     task.Tasks.stderr = data.Tasks.stderr;
-    this.set('serviceTimestamp', new Date().getTime());
+    this.set('serviceTimestamp', App.dateTime());
   },
 
   /**
@@ -199,7 +199,7 @@ App.BackgroundOperationsController = Em.Controller.extend({
       }
     });
     self.set("allOperationsCount", runningServices);
-    self.set('serviceTimestamp', new Date().getTime());
+    self.set('serviceTimestamp', App.dateTime());
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index b1bd7c7..2aa2714 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -93,6 +93,36 @@ App.ClusterController = Em.Controller.extend({
     this.set('isLoaded', true);
   },
 
+  /**
+   * load current server clock in milli-seconds
+   */
+  loadClientServerClockDistance: function () {
+    var dfd = $.Deferred();
+    this.getServerClock().done(function () {
+      dfd.resolve();
+    });
+    return dfd.promise();
+  },
+
+  getServerClock: function(){
+    return App.ajax.send({
+      name: 'ambari.service.load_server_clock',
+      sender: this,
+      success: 'getServerClockSuccessCallback',
+      error: 'getServerClockErrorCallback'
+    });
+  },
+  getServerClockSuccessCallback: function (data) {
+    var clientClock = new Date().getTime();
+    var serverClock = (data.RootServiceComponents.server_clock).toString();
+    serverClock = serverClock.length < 13? serverClock+ '000': serverClock;
+    App.set('clockDistance', serverClock - clientClock );
+    console.log('loading ambari server clock distance');
+  },
+  getServerClockErrorCallback: function () {
+    console.log('Cannot load ambari server clock');
+  },
+
   getUrl:function (testUrl, url) {
     return (App.testMode) ? testUrl : App.apiPrefix + '/clusters/' + this.get('clusterName') + url;
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
index 1a8d222..129d9ff 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -124,7 +124,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
       );
     });
     this.get('tasks').findProperty('id', taskId).set('hosts', hosts);
-    this.set('serviceTimestamp', new Date().getTime());
+    this.set('serviceTimestamp', App.dateTime());
   },
 
   retryTask: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/controllers/main/admin/security/security_progress_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/security_progress_controller.js b/ambari-web/app/controllers/main/admin/security/security_progress_controller.js
index 23fdd6e..2b02e02 100644
--- a/ambari-web/app/controllers/main/admin/security/security_progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/security/security_progress_controller.js
@@ -77,7 +77,7 @@ App.MainAdminSecurityProgressController = Em.Controller.extend({
         services.push(newService);
       }
     });
-    this.set('serviceTimestamp', new Date().getTime());
+    this.set('serviceTimestamp', App.dateTime());
   }.observes('stages.@each.polledData'),
 
   loadStages: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/controllers/main/apps_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/apps_controller.js b/ambari-web/app/controllers/main/apps_controller.js
index 2b2f0af..737a9d9 100644
--- a/ambari-web/app/controllers/main/apps_controller.js
+++ b/ambari-web/app/controllers/main/apps_controller.js
@@ -220,7 +220,7 @@ App.MainAppsController = Em.ArrayController.extend({
         min:"",
         max:""
       };
-      var nowTime = new Date().getTime();
+      var nowTime = App.dateTime();
 
       switch (value){
         case 'Any':

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index 312bfc2..900c875 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -302,7 +302,7 @@ App.WizardController = Em.Controller.extend({
   },
 
   installServicesSuccessCallback: function (jsonData) {
-    var installStartTime = new Date().getTime();
+    var installStartTime = App.dateTime();
     console.log("TRACE: In success function for the installService call");
     if (jsonData) {
       var requestId = jsonData.Requests.id;

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/controllers/wizard/stack_upgrade/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/stack_upgrade/step3_controller.js b/ambari-web/app/controllers/wizard/stack_upgrade/step3_controller.js
index b246105..617de40 100644
--- a/ambari-web/app/controllers/wizard/stack_upgrade/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/stack_upgrade/step3_controller.js
@@ -357,7 +357,7 @@ App.StackUpgradeStep3Controller = Em.Controller.extend({
         }
       }, this);
     }
-    this.set('serviceTimestamp', new Date().getTime());
+    this.set('serviceTimestamp', App.dateTime());
     return continuePolling;
   },
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index 61a9656..0fa45db 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -382,7 +382,7 @@ App.WizardStep3Controller = Em.Controller.extend({
 
   startRegistration: function () {
     if (this.get('registrationStartedAt') == null) {
-      this.set('registrationStartedAt', new Date().getTime());
+      this.set('registrationStartedAt', App.dateTime());
       console.log('registration started at ' + this.get('registrationStartedAt'));
       this.isHostsRegistered();
     }
@@ -439,7 +439,7 @@ App.WizardStep3Controller = Em.Controller.extend({
           _host.set('bootStatus', 'REGISTERING');
           _host.set('bootLog', (_host.get('bootLog') != null ? _host.get('bootLog') : '') + Em.I18n.t('installer.step3.hosts.bootLog.registering'));
           // update registration timestamp so that the timeout is computed from the last host that finished bootstrapping
-          this.set('registrationStartedAt', new Date().getTime());
+          this.set('registrationStartedAt', App.dateTime());
           stopPolling = false;
           break;
         case 'REGISTERING':
@@ -462,7 +462,7 @@ App.WizardStep3Controller = Em.Controller.extend({
 
     if (stopPolling) {
       this.getHostInfo();
-    } else if (hosts.someProperty('bootStatus', 'RUNNING') || new Date().getTime() - this.get('registrationStartedAt') < this.get('registrationTimeoutSecs') * 1000) {
+    } else if (hosts.someProperty('bootStatus', 'RUNNING') || App.dateTime() - this.get('registrationStartedAt') < this.get('registrationTimeoutSecs') * 1000) {
       // we want to keep polling for registration status if any of the hosts are still bootstrapping (so we check for RUNNING).
       var self = this;
       window.setTimeout(function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/controllers/wizard/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js
index 68846d4..7008720 100644
--- a/ambari-web/app/controllers/wizard/step9_controller.js
+++ b/ambari-web/app/controllers/wizard/step9_controller.js
@@ -602,7 +602,7 @@ App.WizardStep9Controller = Em.Controller.extend({
       };
       if (this.isSuccess(polledData)) {
         clusterStatus.status = 'STARTED';
-        var serviceStartTime = new Date().getTime();
+        var serviceStartTime = App.dateTime();
         clusterStatus.installTime = ((parseInt(serviceStartTime) - parseInt(this.get('content.cluster.installStartTime'))) / 60000).toFixed(2);
       } else {
         clusterStatus.status = 'START FAILED'; // 'START FAILED' implies to step10 that installation was successful but start failed

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/models/alert.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alert.js b/ambari-web/app/models/alert.js
index e2781d9..e5eeec8 100644
--- a/ambari-web/app/models/alert.js
+++ b/ambari-web/app/models/alert.js
@@ -100,7 +100,7 @@ App.Alert = Em.Object.extend({
   }.property('date', 'status'),
   
   makeTimeAtleastMinuteAgo: function(d){
-    var diff = new Date().getTime() - d.getTime();
+    var diff = App.dateTime() - d.getTime();
     if (diff < 60000) {
       diff = 60000 - diff;
       return new Date(d.getTime() - diff );

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/models/user.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/user.js b/ambari-web/app/models/user.js
index dc4509f..1e96914 100644
--- a/ambari-web/app/models/user.js
+++ b/ambari-web/app/models/user.js
@@ -162,7 +162,7 @@ App.CreateUserForm = App.Form.extend({
     });
 
     if (this.get('className')) {
-      App.store.load(this.get('className'), (new Date()).getTime(), formValues);
+      App.store.load(this.get('className'), App.dateTime(), formValues);
     }
     else {
       console.log("Please define class name for your form " + this.constructor);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 0a1cce3..6387f2d 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -26,7 +26,9 @@ module.exports = Em.Route.extend({
     console.log('in /main:enter');
     if (router.getAuthenticated()) {
       App.router.get('clusterController').loadClusterName(false);
-      router.get('mainController').initialize();
+      App.router.get('clusterController').loadClientServerClockDistance().done(function() {
+        router.get('mainController').initialize();
+      });
       // TODO: redirect to last known state
     } else {
       Ember.run.next(function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 2ada34c..a46f32f 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -1321,6 +1321,9 @@ var urls = {
     'real': '/services/AMBARI/components/AMBARI_SERVER',
     'mock': ''
   },
+  'ambari.service.load_server_clock': {
+    'real': '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/server_clock'
+  },
   'dashboard.get.user_pref': {
     'real': '/persist/{key}',
     'mock': '',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/utils/date.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/date.js b/ambari-web/app/utils/date.js
index 8d32a47..964a952 100644
--- a/ambari-web/app/utils/date.js
+++ b/ambari-web/app/utils/date.js
@@ -17,6 +17,7 @@
  */
 
 var validator = require('utils/validator');
+var App = require('app');
 
 module.exports = {
   dateMonths:['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
@@ -53,7 +54,7 @@ module.exports = {
     return date.toDateString();
   },
   /**
-   * Convert starTimestamp to 'DAY_OF_THE_WEEK, MONTH DAY, YEAR HOURS:MINUTES, lasted for DURATION', except for the case: year equals 1969
+   * Convert starTimestamp to 'DAY_OF_THE_WEEK, MONTH DAY, YEAR HOURS:MINUTES', except for the case: year equals 1969
    * @param startTimestamp
    * @return string startTimeSummary
    */
@@ -88,13 +89,16 @@ module.exports = {
     var durationSummary = '';
     var startDate = new Date(startTimestamp);
     var endDate = new Date(endTimestamp);
+    var self = this;
     if (startDate.getFullYear() == 1969 || startTimestamp < 1) {
       return '';
     }
     if (endDate.getFullYear() != 1969 && endTimestamp > 0) {
-      durationSummary = '' + this.timingFormat(endTimestamp - startTimestamp, 1); //lasted for xx secs
+      return '' + this.timingFormat(endTimestamp - startTimestamp, 1); //lasted for xx secs
     } else {
-      durationSummary = '' + this.timingFormat(new Date().getTime() - startTimestamp, 1);
+      // still running, duration till now
+      var time =  (App.dateTime() - startTimestamp) < 0? 0 : (App.dateTime() - startTimestamp) ;
+      durationSummary = '' + this.timingFormat( time , 1);
     }
     return durationSummary;
   },
@@ -117,7 +121,7 @@ module.exports = {
    */
   timingFormat:function (time, /* optional */ zeroValid) {
     var intTime  = parseInt(time);
-    if (zeroValid && intTime == 0) return 0 + '';
+    if (zeroValid && intTime == 0) return 0 + ' secs';
     if (!intTime) return null;
     var timeStr = intTime.toString();
     var lengthOfNumber = timeStr.length;
@@ -154,7 +158,7 @@ module.exports = {
     var duration = 0;
     if (startTime && startTime > 0) {
       if (!endTime || endTime < 1) {
-        endTime = new Date().getTime();
+        endTime = App.dateTime();
       }
       duration = endTime - startTime;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index b4b27e5..d538a32 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -296,6 +296,15 @@ App.tooltip = function(self, options) {
   });
 };
 
+/**
+ * wrapper to Date().getTime()
+ * fix issue when client clock and server clock not sync
+ * @return timeStamp of current server clock
+ */
+App.dateTime = function() {
+  return new Date().getTime() + App.clockDistance;
+};
+
 /*
  * Helper function for bound property helper registration
  * @params name {String} - name of helper

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/utils/http_client.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/http_client.js b/ambari-web/app/utils/http_client.js
index d0d51f3..8d99069 100644
--- a/ambari-web/app/utils/http_client.js
+++ b/ambari-web/app/utils/http_client.js
@@ -58,7 +58,7 @@ App.HttpClient = Em.Object.create({
     }
 
     var xhr = new XMLHttpRequest();
-    var curTime = new Date().getTime();
+    var curTime = App.dateTime();
 
     xhr.open('GET', url + (url.indexOf('?') >= 0 ? '&_=' : '?_=') + curTime, true);
     xhr.send(null);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/views/common/chart/linear_time.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/chart/linear_time.js b/ambari-web/app/views/common/chart/linear_time.js
index bf8dcab..e81e5c5 100644
--- a/ambari-web/app/views/common/chart/linear_time.js
+++ b/ambari-web/app/views/common/chart/linear_time.js
@@ -162,7 +162,7 @@ App.ChartLinearTimeView = Ember.View.extend({
   },
 
   getDataForAjaxRequest: function() {
-    var toSeconds = Math.round(new Date().getTime() / 1000);
+    var toSeconds = Math.round(App.dateTime() / 1000);
     var hostName = (this.get('content')) ? this.get('content.hostName') : "";
 
     var HDFSService = App.HDFSService.find().objectAt(0);
@@ -262,8 +262,8 @@ App.ChartLinearTimeView = Ember.View.extend({
         // Same number applies to all time.
         var number = seriesData;
         seriesData = [];
-        seriesData.push([number, new Date().getTime()-(60*60)]);
-        seriesData.push([number, new Date().getTime()]);
+        seriesData.push([number, App.dateTime()-(60*60)]);
+        seriesData.push([number, App.dateTime()]);
       }
       // We have valid data
       var series = {};
@@ -416,7 +416,7 @@ App.ChartLinearTimeView = Ember.View.extend({
    * @param {Array} data
    */
   dataShiftFix: function(data) {
-    var nowTime = Math.round(new Date().getTime() / 1000);
+    var nowTime = Math.round(App.dateTime() / 1000);
     data.forEach(function(series){
       var l = series.data.length;
       var shiftDiff = nowTime - series.data[l - 1].x;

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/views/common/configs/services_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/services_config.js b/ambari-web/app/views/common/configs/services_config.js
index 4fc4a14..68aa7e1 100644
--- a/ambari-web/app/views/common/configs/services_config.js
+++ b/ambari-web/app/views/common/configs/services_config.js
@@ -918,7 +918,7 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
     }, this);
     adminConfig.set('value', admin.join(' '));
     submitConfig.set('value', submit.join(' '));
-    this.set('queueObserver', new Date().getTime());
+    this.set('queueObserver', App.dateTime());
   },
   /**
    * delete queue
@@ -935,7 +935,7 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
         i--;
       }
     }
-    this.set('queueObserver', new Date().getTime());
+    this.set('queueObserver', App.dateTime());
   },
   /**
    * save changes that was made to queue
@@ -966,7 +966,7 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
         _config.set('name', configName.replace(queueNamePrefix + queue.name, queueNamePrefix + queue.configs.findProperty('name', 'queueName').get('value')));
       }
     }, this);
-    this.set('queueObserver', new Date().getTime());
+    this.set('queueObserver', App.dateTime());
   },
   pieChart: App.ChartPieView.extend({
     w: 200,

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/views/common/filter_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/filter_view.js b/ambari-web/app/views/common/filter_view.js
index 630c30b..5a9693d 100644
--- a/ambari-web/app/views/common/filter_view.js
+++ b/ambari-web/app/views/common/filter_view.js
@@ -25,6 +25,9 @@
  * All inner views implemented below this view.
  * @type {*}
  */
+
+var App = require('app');
+
 var wrapperView = Ember.View.extend({
   classNames: ['view-wrapper'],
   layout: Ember.Handlebars.compile('<a href="#" {{action "clearFilter" target="view"}} class="ui-icon ui-icon-circle-close"></a> {{yield}}'),
@@ -368,7 +371,7 @@ module.exports = {
       case 'date':
         return function (rowValue, rangeExp) {
           var match = false;
-          var timePassed = new Date().getTime() - rowValue;
+          var timePassed = App.dateTime() - rowValue;
           switch (rangeExp) {
             case 'Past 1 hour':
               match = timePassed <= 3600000;

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/views/main/dashboard/service/hbase.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/hbase.js b/ambari-web/app/views/main/dashboard/service/hbase.js
index e3d858d..e2e8462 100644
--- a/ambari-web/app/views/main/dashboard/service/hbase.js
+++ b/ambari-web/app/views/main/dashboard/service/hbase.js
@@ -115,7 +115,7 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
   masterStartedTime: function () {
     var uptime = this.get('service').get('masterStartTime');
     if (uptime && uptime > 0) {
-      var diff = (new Date()).getTime() - uptime;
+      var diff = App.dateTime() - uptime;
       if (diff < 0) {
         diff = 0;
       }
@@ -128,7 +128,7 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
   masterActivatedTime: function () {
     var uptime = this.get('service').get('masterActiveTime');
     if (uptime && uptime > 0) {
-      var diff = (new Date()).getTime() - uptime;
+      var diff = App.dateTime() - uptime;
       if (diff < 0) {
         diff = 0;
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/views/main/dashboard/service/hdfs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/hdfs.js b/ambari-web/app/views/main/dashboard/service/hdfs.js
index aa8d038..aa06305 100644
--- a/ambari-web/app/views/main/dashboard/service/hdfs.js
+++ b/ambari-web/app/views/main/dashboard/service/hdfs.js
@@ -101,7 +101,7 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
   nodeUptime: function () {
     var uptime = this.get('service').get('nameNodeStartTime');
     if (uptime && uptime > 0){
-      var diff = (new Date()).getTime() - uptime;
+      var diff = App.dateTime() - uptime;
       if (diff < 0) {
         diff = 0;
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/views/main/dashboard/service/mapreduce.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/mapreduce.js b/ambari-web/app/views/main/dashboard/service/mapreduce.js
index 214dac2..dd2f1b4 100644
--- a/ambari-web/app/views/main/dashboard/service/mapreduce.js
+++ b/ambari-web/app/views/main/dashboard/service/mapreduce.js
@@ -35,7 +35,7 @@ App.MainDashboardServiceMapreduceView = App.MainDashboardServiceView.extend({
   jobTrackerUptime: function () {
     var uptime = this.get('service').get('jobTrackerStartTime');
     if (uptime && uptime > 0){
-      var diff = (new Date()).getTime() - uptime;
+      var diff = App.dateTime() - uptime;
       if (diff < 0) {
         diff = 0;
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/views/main/dashboard/service/yarn.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/yarn.js b/ambari-web/app/views/main/dashboard/service/yarn.js
index 8e7751e..3b25f46 100644
--- a/ambari-web/app/views/main/dashboard/service/yarn.js
+++ b/ambari-web/app/views/main/dashboard/service/yarn.js
@@ -55,7 +55,7 @@ App.MainDashboardServiceYARNView = App.MainDashboardServiceView.extend({
   nodeUptime: function () {
     var uptime = this.get('service').get('resourceManagerStartTime');
     if (uptime && uptime > 0){
-      var diff = (new Date()).getTime() - uptime;
+      var diff = App.dateTime() - uptime;
       if (diff < 0) {
         diff = 0;
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js b/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
index f34c6e1..e583522 100644
--- a/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
+++ b/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
@@ -96,7 +96,7 @@ App.UptimeTextDashboardWidgetView = App.TextDashboardWidgetView.extend({
 
   uptimeProcessing: function(uptime) {
     var uptimeString = this.timeConverter(uptime);
-    var diff = (new Date()).getTime() - uptime;
+    var diff = App.dateTime() - uptime;
     if (diff < 0) {
       diff = 0;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6e45925/ambari-web/vendor/scripts/jquery.timeago.js
----------------------------------------------------------------------
diff --git a/ambari-web/vendor/scripts/jquery.timeago.js b/ambari-web/vendor/scripts/jquery.timeago.js
index 2e8d29f..41e7827 100644
--- a/ambari-web/vendor/scripts/jquery.timeago.js
+++ b/ambari-web/vendor/scripts/jquery.timeago.js
@@ -139,13 +139,18 @@
   }
 
   function inWords(date) {
-    return $t.inWords(distance(date));
+    return $t.inWords(distanceToServerClock(date));
   }
 
   function distance(date) {
     return (new Date().getTime() - date.getTime());
   }
 
+  function distanceToServerClock(date) {
+    var App = require('app');
+    return (App.dateTime() - date.getTime());
+  }
+
   // fix for IE6 suckage
   document.createElement("abbr");
   document.createElement("time");