← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

Re: [Merge] lp:~gang65/ubuntu-clock-app/ubuntu-clock-stopwatch-timezone-fix into lp:ubuntu-clock-app

 

Review: Needs Fixing

Fix the inline comments and this is good to merge. On testing it works nicely! Well done!

Diff comments:

> === 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
> @@ -37,28 +37,42 @@
>          console.log("[LOG]: Stopwatch Page Loaded")
>      }
>  

Nevermind, I couldn't simplify this any further. Your approach seems to be the only way. Just a minor thing, remove the semicolor ; since it is inconsistent.

> +    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 {


-- 
https://code.launchpad.net/~gang65/ubuntu-clock-app/ubuntu-clock-stopwatch-timezone-fix/+merge/269768
Your team Ubuntu Clock Developers is subscribed to branch lp:ubuntu-clock-app.


References