Fix midnight better

pull/3560/head
Martin Pool 2024-09-06 22:45:18 +02:00
parent 85650f6d4b
commit 610e1808f5
3 changed files with 6 additions and 4 deletions

View File

@ -1,3 +1,4 @@
0.12: First release 0.12: First release
0.13: Fix widgets reappearing 0.13: Fix widgets reappearing
0.14: Fix midnight 0.14: Fix midnight
0.15: Fix midnight better

View File

@ -15,6 +15,7 @@ const BOTTOM_SPACING = 5;
const TEXT_WIDTH = SCREEN_WIDTH - 2; const TEXT_WIDTH = SCREEN_WIDTH - 2;
const MINS_IN_HOUR = 60; const MINS_IN_HOUR = 60;
const MINS_IN_DAY = 24 * MINS_IN_HOUR;
const VARIANT_EXACT = 'exact'; const VARIANT_EXACT = 'exact';
const VARIANT_APPROXIMATE = 'approximate'; const VARIANT_APPROXIMATE = 'approximate';
@ -69,7 +70,7 @@ function initialize() {
function tick() { function tick() {
date = new Date(); date = new Date();
const m = date.getHours() * MINS_IN_HOUR + date.getMinutes(); const m = (date.getHours() * MINS_IN_HOUR + date.getMinutes()) % MINS_IN_DAY;
if (m !== mins) { if (m !== mins) {
mins = m; mins = m;
@ -214,7 +215,7 @@ function getRoundMinutes(m) {
const nearest = roundTo(5)(m); const nearest = roundTo(5)(m);
return { return {
minutes: nearest % 60, minutes: nearest,
offset: m - nearest offset: m - nearest
}; };
} }

View File

@ -3,7 +3,7 @@
"name": "Dutch Clock", "name": "Dutch Clock",
"shortName":"Dutch Clock", "shortName":"Dutch Clock",
"icon": "app.png", "icon": "app.png",
"version":"0.14", "version":"0.15",
"description": "A clock that displays the time the way a Dutch person would respond when asked what time it is.", "description": "A clock that displays the time the way a Dutch person would respond when asked what time it is.",
"type": "clock", "type": "clock",
"tags": "clock,dutch,text", "tags": "clock,dutch,text",