diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..5c6eca5 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,108 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..8306744 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/css/style.css b/css/style.css index c8a820b..7a2ad54 100644 --- a/css/style.css +++ b/css/style.css @@ -19,6 +19,10 @@ h1 { font-family: Arvo, serif; } +ul { + list-style-type: none; +} + ul li { height: 32px; } @@ -40,11 +44,14 @@ ul li { font-size: 18px; } -#clock { - font-family: 'eridani' !important; +#clock-eridani, #clock-human { color: #52ff7c; font-size: 62px; text-align: center; padding-top: 60px; - padding-bottom: 40px; + padding-bottom: 20px; +} + +#clock-eridani { + font-family: 'eridani' !important; } \ No newline at end of file diff --git a/index.html b/index.html index ba7c569..d67dbf9 100644 --- a/index.html +++ b/index.html @@ -9,21 +9,24 @@ -
-
-

- This clock shows the Eridian number of Earth seconds that have passed on Earth today. -

-
+
-

Time measurement on Earth

- +
+
+

This clock shows the number of Eridian seconds that have passed on Earth + today (UTC).

+

One day on earth lasts 441021 Eridian + seconds.

+

1 = 2.366

+
+ +
+
+

This clock shows the number of Earth seconds that have passed today (UTC).

+
+ + \ No newline at end of file diff --git a/js/scripts.js b/js/scripts.js index 8cb0e14..b683576 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -1,22 +1,45 @@ -function earthTime() { +function eridaniTime() { let date = new Date(); let hours = date.getUTCHours() let minutes = date.getUTCMinutes() let seconds = date.getUTCSeconds() + let milliseconds = date.getUTCMilliseconds(); + let secondsToday = (hours * 3600) + (minutes * 60) + seconds + (milliseconds / 1000); - document.getElementById("clock").innerText = - appendLeadingZeros(((hours * 3600) + (minutes * 60) + seconds).toString(6)); - - setTimeout(function () { - earthTime() - }, 1000); + document.getElementById("clock-eridani").innerText = + appendLeadingZeros(((secondsToday / 2.366).toString(6).split(".")[0]), 6); } -function appendLeadingZeros(time) { - while (time.length < 7) { +function humanTime() { + let date = new Date(); + let hours = date.getUTCHours() + let minutes = date.getUTCMinutes() + let seconds = date.getUTCSeconds() + let milliseconds = date.getUTCMilliseconds(); + let secondsToday = (hours * 3600) + (minutes * 60) + seconds + (milliseconds / 1000); + + document.getElementById("clock-human").innerText = + appendLeadingZeros(secondsToday.toString(10).split(".")[0], 5); +} + +function appendLeadingZeros(time, zeros) { + while (time.length < zeros) { time = "0" + time; } return time; } -earthTime(); \ No newline at end of file +function tick() { + setInterval(eridaniTime, 2366); +} + +function tock() { + setInterval(humanTime, 1000); +} + +document.addEventListener("DOMContentLoaded", function() { + eridaniTime(); + humanTime(); + tick(); + tock(); +}); \ No newline at end of file