maybe i should stick to milleseconds

This commit is contained in:
Boof 2023-06-09 11:56:46 +02:00 committed by GitHub
parent f084d62f88
commit 88c3af924a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

View File

@ -22,7 +22,7 @@
</div>
<br>
<div>
<p>Want to know how old you are in nanoseconds? <a href="ms.html">Go here</a></p>
<p>Want to know how old you are in millieseconds? <a href="ms.html">Go here</a></p>
<h3>What day was my birthday Jun 8, 2009?</h3>
<p>June 8, 2009 was a Monday and it was the 159th day of the year 2009. It was the 23rd Monday of that year. The
next time you can reuse your old 2009 calendar will be in 2026. Both calendars will be exactly the same!

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>How old are you in nanoseconds?</title>
<title>How old are you in millieseconds?</title>
<script src="ms.js" defer></script>
</head>
<body>

7
ms.js
View File

@ -2,11 +2,8 @@ function calculateYearsSince() {
const myDate = new Date('2009-06-08');
const diffInMs = Date.now() - myDate.getTime();
const diffInNs = diffInMs * 1000000
document.getElementById("number").innerText = diffInNs
document.getElementById("number").innerText = diffInMs
}
while (true) {
calculateYearsSince()
}
setInterval(calculateYearsSince, 0.1)