From c9d48cf91c01f5e7820515b58660ffb5578de4e3 Mon Sep 17 00:00:00 2001 From: Christopher Conley Date: Tue, 15 Aug 2023 12:13:58 -0400 Subject: [PATCH] InternetTimeDesklet@stefan: Fix timezone (#909) Change the hour/minute/second variable assignments to explicitly be in UTC format. Also, add one hour to the "getUTCHours()" call, as the "Biel Mean Time" (BMT) which Beat Time is based upon, is defined by Swatch as UTC+1. Previously this was calling Date's getHours/getMinutes/getSeconds functions, which returns LOCAL time. This had the effect of meaning the Beat time returned by this desklet was always incorrect unless your computer's time is set to the UTC+1 timezone. This commit fixes that and ensures that the correct universal Beat Time will be displayed regardless of the user's timezone. --- .../files/InternetTimeDesklet@stefan/desklet.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/InternetTimeDesklet@stefan/files/InternetTimeDesklet@stefan/desklet.js b/InternetTimeDesklet@stefan/files/InternetTimeDesklet@stefan/desklet.js index 0b214fc94..d261f2e0f 100644 --- a/InternetTimeDesklet@stefan/files/InternetTimeDesklet@stefan/desklet.js +++ b/InternetTimeDesklet@stefan/files/InternetTimeDesklet@stefan/desklet.js @@ -74,9 +74,9 @@ NetBeatDesklet.prototype = { refresh: function() { let d = new Date(); - let h = d.getHours(); - let m = d.getMinutes(); - let s = d.getSeconds(); + let h = d.getUTCHours() + 1; + let m = d.getUTCMinutes(); + let s = d.getUTCSeconds(); //let tzoff = 60 + d.getTimezoneOffset(); //let beats = ('000' + Math.floor((s + (m + tzoff) * 60 + h * 3600) / 86.4) % 1000).slice(-3);