Skip to content

Commit c7eabbe

Browse files
author
thyttan
committed
doztime: Bangle 1 - fix scoping of vars time and wait
1 parent 1ccde9c commit c7eabbe

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

apps/doztime/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
now supports Adjust Clock widget, if installed
88
0.06: Minor code improvements
99
0.07: Bangle2: Shift the position of one line on the screen
10+
0.08: Bangle1: fix scoping of variables `time` and `wait`

apps/doztime/app-bangle1.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,20 +159,22 @@ function drawTime()
159159
let date = "";
160160
let timeDef;
161161
let x = 0;
162+
let time;
163+
let wait;
162164
dt.setDate(dt.getDate());
163165
if(addTimeDigit){
164166
x =
165167
10368*dt.getHours()+172.8*dt.getMinutes()+2.88*dt.getSeconds()+0.00288*dt.getMilliseconds();
166168
let msg = "00000"+Math.floor(x).toString(12);
167-
let time = msg.substr(-5,3)+"."+msg.substr(-2); //TODO: should `time` and `wait` have been defined outside the if block?
168-
let wait = 347*(1-(x%1));
169+
time = msg.substr(-5,3)+"."+msg.substr(-2);
170+
wait = 347*(1-(x%1));
169171
timeDef = time6;
170172
} else {
171173
x =
172174
864*dt.getHours()+14.4*dt.getMinutes()+0.24*dt.getSeconds()+0.00024*dt.getMilliseconds();
173175
let msg = "0000"+Math.floor(x).toString(12);
174-
let time = msg.substr(-4,3)+"."+msg.substr(-1);
175-
let wait = 4167*(1-(x%1));
176+
time = msg.substr(-4,3)+"."+msg.substr(-1);
177+
wait = 4167*(1-(x%1));
176178
timeDef = time5;
177179
}
178180
if(lastX > x){ res = getDate(dt); } // calculate date once at start-up and once when turning over to a new day

apps/doztime/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "doztime",
33
"name": "Dozenal Digital Time",
44
"shortName": "Dozenal Digital",
5-
"version": "0.07",
5+
"version": "0.08",
66
"description": "A dozenal Holocene calendar and dozenal diurnal digital clock",
77
"icon": "app.png",
88
"type": "clock",

0 commit comments

Comments
 (0)