Bug 794127 - hal::AdjustSystemClock should take a 64-bit value. r=cjones
authorGene Lian <clian@mozilla.com>
Wed, 26 Sep 2012 11:51:29 +0800
changeset 114424 6b444917f491c4d4fb5ea9a64a3f63b8860acb34
parent 114423 71192a9431a74baf053bb127f2c61d2455a20590
child 114425 be28055643f51b1370c67b8856e9e8a6d6df8e89
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs794127
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 794127 - hal::AdjustSystemClock should take a 64-bit value. r=cjones
dom/time/TimeManager.cpp
hal/Hal.cpp
hal/Hal.h
hal/fallback/FallbackTime.cpp
hal/gonk/GonkHal.cpp
hal/sandbox/PHal.ipdl
hal/sandbox/SandboxHal.cpp
--- a/dom/time/TimeManager.cpp
+++ b/dom/time/TimeManager.cpp
@@ -43,15 +43,15 @@ TimeManager::Set(const JS::Value& date, 
       return NS_ERROR_INVALID_ARG;
     }
   } else if (date.isNumber()) {
     dateMSec = date.toNumber();
   } else {
     return NS_ERROR_INVALID_ARG;
   }
 
-  hal::AdjustSystemClock(JS_DoubleToInt32(dateMSec - nowMSec));
+  hal::AdjustSystemClock(dateMSec - nowMSec);
   return NS_OK;
 }
 
 } // namespace time
 } // namespace dom
 } // namespace mozilla
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -436,17 +436,17 @@ UnregisterSystemTimeChangeObserver(Syste
 
 void
 NotifySystemTimeChange(const hal::SystemTimeChange& aReason)
 {
   sSystemTimeObservers.BroadcastInformation(aReason);
 }
  
 void 
-AdjustSystemClock(int32_t aDeltaMilliseconds)
+AdjustSystemClock(int64_t aDeltaMilliseconds)
 {
   AssertMainThread();
   PROXY_IF_SANDBOXED(AdjustSystemClock(aDeltaMilliseconds));
 }
 
 void 
 SetTimezone(const nsCString& aTimezoneSpec)
 {
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -237,17 +237,17 @@ void GetCurrentNetworkInformation(hal::N
  * @param aNetworkInfo The new network information.
  */
 void NotifyNetworkChange(const hal::NetworkInformation& aNetworkInfo);
 
 /**
  * Adjusting system clock.
  * @param aDeltaMilliseconds The difference compared with current system clock.
  */
-void AdjustSystemClock(int32_t aDeltaMilliseconds);
+void AdjustSystemClock(int64_t aDeltaMilliseconds);
 
 /**
  * Set timezone
  * @param aTimezoneSpec The definition can be found in 
  * http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  */
 void SetTimezone(const nsCString& aTimezoneSpec);
 
--- a/hal/fallback/FallbackTime.cpp
+++ b/hal/fallback/FallbackTime.cpp
@@ -6,17 +6,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "Hal.h"
 
 namespace mozilla {
 namespace hal_impl {
 
 void 
-AdjustSystemClock(int32_t aDeltaMilliseconds)
+AdjustSystemClock(int64_t aDeltaMilliseconds)
 {}
 
 void
 SetTimezone(const nsCString& aTimezoneSpec)
 {}
 
 nsCString
 GetTimezone()
--- a/hal/gonk/GonkHal.cpp
+++ b/hal/gonk/GonkHal.cpp
@@ -610,29 +610,29 @@ GetLight(hal::LightType light, hal::Ligh
  */
 static int
 sys_clock_settime(clockid_t clk_id, const struct timespec *tp)
 {
   return syscall(__NR_clock_settime, clk_id, tp);
 }
 
 void
-AdjustSystemClock(int32_t aDeltaMilliseconds)
+AdjustSystemClock(int64_t aDeltaMilliseconds)
 {
   if (aDeltaMilliseconds == 0) {
     return;
   }
 
   struct timespec now;
 
   // Preventing context switch before setting system clock
   sched_yield();
   clock_gettime(CLOCK_REALTIME, &now);
-  now.tv_sec += aDeltaMilliseconds/1000;
-  now.tv_nsec += (aDeltaMilliseconds%1000)*NsecPerMsec;
+  now.tv_sec += aDeltaMilliseconds / 1000;
+  now.tv_nsec += (aDeltaMilliseconds % 1000) * NsecPerMsec;
   if (now.tv_nsec >= NsecPerSec)
   {
     now.tv_sec += 1;
     now.tv_nsec -= NsecPerSec;
   }
 
   if (now.tv_nsec < 0)
   {
--- a/hal/sandbox/PHal.ipdl
+++ b/hal/sandbox/PHal.ipdl
@@ -126,17 +126,17 @@ parent:
     SetScreenEnabled(bool enabled);
 
     sync GetCpuSleepAllowed() returns (bool allowed);
     SetCpuSleepAllowed(bool allowed);
 
     sync GetScreenBrightness() returns (double brightness);
     SetScreenBrightness(double brightness);
 
-    AdjustSystemClock(int32_t aDeltaMilliseconds);
+    AdjustSystemClock(int64_t aDeltaMilliseconds);
     SetTimezone(nsCString aTimezoneSpec);
     sync GetTimezone()
       returns (nsCString aTimezoneSpec);
     EnableSystemTimeChangeNotifications();
     DisableSystemTimeChangeNotifications();
 
     sync SetLight(LightType light, LightConfiguration aConfig)
       returns (bool status);
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -179,17 +179,17 @@ bool
 GetLight(hal::LightType light, hal::LightConfiguration* aConfig)
 {
   bool status;
   Hal()->SendGetLight(light, aConfig, &status);
   return status;
 }
 
 void 
-AdjustSystemClock(int32_t aDeltaMilliseconds)
+AdjustSystemClock(int64_t aDeltaMilliseconds)
 {
   Hal()->SendAdjustSystemClock(aDeltaMilliseconds);
 }
 
 void
 SetTimezone(const nsCString& aTimezoneSpec)
 {
   Hal()->SendSetTimezone(nsCString(aTimezoneSpec));
@@ -587,17 +587,17 @@ public:
     if (!AssertAppProcessPermission(this, "power")) {
       return false;
     }
     *status = hal::GetLight(aLight, aConfig);
     return true;
   }
 
   virtual bool
-  RecvAdjustSystemClock(const int32_t &aDeltaMilliseconds) MOZ_OVERRIDE
+  RecvAdjustSystemClock(const int64_t &aDeltaMilliseconds) MOZ_OVERRIDE
   {
     if (!AssertAppProcessPermission(this, "time")) {
       return false;
     }
     hal::AdjustSystemClock(aDeltaMilliseconds);
     return true;
   }