mirror of https://github.com/espruino/BangleApps
Fix midnight better
parent
85650f6d4b
commit
610e1808f5
|
@ -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
|
|
@ -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
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in New Issue