const TYMESL1P = 725; const AGO_OFFSET = 12; function jsKaarn17(seconds) { let s = seconds.toString().padStart(10, '0'); return s.slice(0, 4) + ":" + s.slice(4, 5) + ":" + s.slice(5, 7) + ":" + s.slice(7, 10); } function formatGregorian() { const now = new Date(); // Force Central Time and format the date const dateOptions = { month: 'short', day: '2-digit', year: 'numeric', timeZone: 'America/Chicago' }; let dateString = now.toLocaleDateString('en-US', dateOptions); dateString = dateString.replace(/202\d/, '2020'); // Format the time in Central Time const timeOptions = { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: true, timeZone: 'America/Chicago' }; const timeString = now.toLocaleTimeString('en-US', timeOptions); return `${dateString} ${timeString}`; } function formatAgoQuirky(ts) { const now = Date.now(); let distance = now - ts * 1000; let days = Math.floor(distance / (1000 * 60 * 60 * 24)); let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); let seconds = Math.floor((distance % (1000 * 60)) / 1000); minutes += AGO_OFFSET; seconds += AGO_OFFSET; hours = ('00' + hours).slice(-2); minutes = ('00' + minutes).slice(-2); seconds = ('00' + seconds).slice(-2); return days > 0 ? `${days}d:${hours}h:${minutes}m ago` : `${hours}h:${minutes}m:${seconds}s ago`; } function updateAllClocks() { const nowSeconds = Math.floor(Date.now() / 1000) - TYMESL1P; const gregEl = document.getElementById("gregorian-clock"); if (gregEl) gregEl.innerHTML = formatGregorian(); document.querySelectorAll(".kaarn17").forEach(el => { el.innerHTML = jsKaarn17(nowSeconds); }); document.querySelectorAll(".ago-clock").forEach(el => { const ts = parseInt(el.dataset.ts); if (ts) el.innerHTML = formatAgoQuirky(ts); }); } document.addEventListener("DOMContentLoaded", () => { updateAllClocks(); setInterval(updateAllClocks, 250); });