Use Math.floor instead of parseInt to avoid problems with very small numbers like 2e-10
This commit is contained in:
parent
396d531770
commit
28d370f2af
1 changed files with 3 additions and 3 deletions
|
@ -212,9 +212,9 @@
|
||||||
now = new Date();
|
now = new Date();
|
||||||
|
|
||||||
diff = now.getTime() - start.getTime();
|
diff = now.getTime() - start.getTime();
|
||||||
hours = parseInt( diff / ( 1000 * 60 * 60 ) );
|
hours = Math.floor( diff / ( 1000 * 60 * 60 ) );
|
||||||
minutes = parseInt( ( diff / ( 1000 * 60 ) ) % 60 );
|
minutes = Math.floor( ( diff / ( 1000 * 60 ) ) % 60 );
|
||||||
seconds = parseInt( ( diff / 1000 ) % 60 );
|
seconds = Math.floor( ( diff / 1000 ) % 60 );
|
||||||
|
|
||||||
clockEl.innerHTML = now.toLocaleTimeString();
|
clockEl.innerHTML = now.toLocaleTimeString();
|
||||||
hoursEl.innerHTML = zeroPadInteger( hours );
|
hoursEl.innerHTML = zeroPadInteger( hours );
|
||||||
|
|
Loading…
Reference in a new issue