Skip to content

Commit

Permalink
fix issue where time numerals weren't being updated every minute if e…
Browse files Browse the repository at this point in the history
…phemeris refresh rate was too high
  • Loading branch information
mmarquez76 committed May 31, 2023
1 parent 991365d commit ca84421
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ window.addEventListener(
signs = ["L", "K", "J", "I", "H", "G", "F", "E", "D", "C", "B", "A"],
radius,
date,
seconds,
lastUpdateTime,
illumFraction,
offsetAscendant,
isNight = false,
Expand Down Expand Up @@ -338,19 +338,19 @@ window.addEventListener(
// Only get a new ephemeris every cooldown period to save resources
// When a new ephemeris is fetched, redraw all resources that depend on it
if (
Math.floor(seconds / EPHEMERIS_COOLDOWN) !=
Math.floor(lastUpdateTime / EPHEMERIS_COOLDOWN) !=
Math.floor(date.getSeconds() / EPHEMERIS_COOLDOWN)
) {
getSigns();
clearCanvas(signCanvas);
seconds = date.getSeconds();
lastUpdateTime = date.getSeconds();
drawInnerFace();
drawInnerSigns();
drawMoonPhase();
drawSignHands();
}
// Only redraw innerCanvas to highlight new numbers every minute
if (Math.floor(seconds) % 60 == 0) {
if (Math.floor(date.getSeconds()) % 60 == 0) {
clearCanvas(innerCanvas);
drawNumerals();
}
Expand Down

0 comments on commit ca84421

Please sign in to comment.