Skip to content

Commit

Permalink
issues/1 Scale minutes to 0-60
Browse files Browse the repository at this point in the history
  • Loading branch information
j0hncc committed May 17, 2024
1 parent b350d45 commit 7303be5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@
function updateClock(usdPrice) {
const satsPerDollar = Math.floor(100000000 / usdPrice);
const hours = Math.floor(satsPerDollar / 100);
const minutes = satsPerDollar % 100;
const minutes = scaleMinutes(satsPerDollar % 100);
const formattedTime = `${hours}:${minutes < 10 ? '0' : ''}${minutes}`;
document.getElementById('clock').textContent = formattedTime;
}

// issues/1 make minutes be between 0 and 59
function scaleMinutes(mm) {
return Math.floor(mm/100*60);
}

async function initClock() {
const usdPrice = await fetchBitcoinPrice();
if (usdPrice !== null) {
Expand Down

0 comments on commit 7303be5

Please sign in to comment.