ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #04701
[Merge] lp:~gang65/ubuntu-clock-app/ubuntu-clock-stopwatch-timezone-fix into lp:ubuntu-clock-app
Bartosz Kosiorek has proposed merging lp:~gang65/ubuntu-clock-app/ubuntu-clock-stopwatch-timezone-fix into lp:ubuntu-clock-app.
Commit message:
Fix stopwatch time issue after changing timezone, when stopwatch is running (LP: #1491024)
Requested reviews:
Ubuntu Clock Developers (ubuntu-clock-dev)
Related bugs:
Bug #1491024 in Ubuntu Clock App: "Stopwatch is not working correctly after change timezone"
https://bugs.launchpad.net/ubuntu-clock-app/+bug/1491024
For more details, see:
https://code.launchpad.net/~gang65/ubuntu-clock-app/ubuntu-clock-stopwatch-timezone-fix/+merge/269768
Fix stopwatch time issue after changing timezone, when stopwatch is running (LP: #1491024)
--
Your team Ubuntu Clock Developers is requested to review the proposed merge of lp:~gang65/ubuntu-clock-app/ubuntu-clock-stopwatch-timezone-fix into lp:ubuntu-clock-app.
=== modified file 'app/stopwatch/StopwatchPage.qml'
--- app/stopwatch/StopwatchPage.qml 2015-08-25 01:02:54 +0000
+++ app/stopwatch/StopwatchPage.qml 2015-09-01 15:24:48 +0000
@@ -24,7 +24,7 @@
id: _stopwatchPage
objectName: "stopwatchPage"
- property date startTime: new Date()
+ property date startTime: getUTCDate()
property date snapshot: startTime
property bool running: false
@@ -37,28 +37,42 @@
console.log("[LOG]: Stopwatch Page Loaded")
}
+ function getUTCDate() {
+ var localDate = new Date()
+ return new Date(localDate.getUTCFullYear(),
+ localDate.getUTCMonth(),
+ localDate.getUTCDate(),
+ localDate.getUTCHours(),
+ localDate.getUTCMinutes(),
+ localDate.getUTCSeconds(),
+ localDate.getUTCMilliseconds());
+ }
+
function start() {
- startTime = new Date()
+ startTime = getUTCDate()
snapshot = startTime
running = true
}
function stop() {
oldDiff += timeDiff
- startTime = new Date()
+ startTime = getUTCDate()
snapshot = startTime
running = false
}
function update() {
- snapshot = new Date()
+ snapshot = getUTCDate()
+ timeDiff = snapshot - startTime
+ totalTimeDiff = timeDiff + oldDiff
}
function clear() {
oldDiff = 0
- startTime = new Date()
+ startTime = getUTCDate()
snapshot = startTime
lapHistory.clear()
+ totalTimeDiff = 0
}
Timer {
Follow ups