-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclock.js
More file actions
40 lines (31 loc) · 938 Bytes
/
clock.js
File metadata and controls
40 lines (31 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var minutes = 0;
var seconds = 0;
var decaseconds = 0;
var triacontapentasec = 0; // Technically Greek, 1/35th of a second. Roughly what the highest fraction of a second value was observed.
var time = "";
var start = Date.now();
var current = 0;
var delta = 0;
function iterateClock() {
delta = Date.now() - this.start;
seconds = Math.round(delta / 1000);
minutes = Math.round(seconds / 60);
triacontapentasec = Math.round(delta % 35);
}
function getClockTime() {
var stringBuilder = "";
stringBuilder += getMinutes() + ':';
if(getSecondsDisplay() < 10) stringBuilder += '0';
stringBuilder += getSecondsDisplay() + '.' + getTriacontapentasec();
time = stringBuilder;
return time;
}
function getTriacontapentasec() {
return triacontapentasec;
}
function getMinutes() {
return minutes;
}
function getSecondsDisplay() {
return seconds % 60;
}