-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
111 lines (104 loc) · 6.84 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap" rel="stylesheet">
<link rel="apple-touch-icon" sizes="57x57" href="img/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="img/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="img/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="img/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="img/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="img/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="img/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="img/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png">
<link rel="manifest" href="img/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="img/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="imgfavicon.ico" type="image/x-icon">
<style>
body{
font-family: 'Source Code Pro', monospace;
}
</style>
<title>unixy2k countdown</title>
</head>
<body class="min-h-screen flex flex-col justify-center items-center">
<div class="container mx-auto text-center">
<h1 class="text-4xl font-bold mt-4">Real-time UTC Date</h1>
<p id="current-date" class="text-lg mt-4"></p>
<p id="epoch-time" class="text-lg mt-2"></p>
<p id="epoch-binary" class="text-lg mt-2"></p>
</div>
<div class="container mx-auto text-center mt-8">
<h2 class="text-2xl font-bold">Remaining Time until <a href="https://en.wikipedia.org/wiki/Year_2038_problem">Year 2038 problem</a></h2>
<p id="remaining-time" class="text-lg mt-2"></p>
</div>
<footer class="fixed bottom-0 left-0 z-20 w-full p-4 bg-white border-t border-gray-200 shadow md:flex md:items-center md:justify-between md:p-6 dark:bg-gray-800 dark:border-gray-600">
<span class="text-sm text-gray-500 sm:text-center dark:text-gray-400">© 2023 <a href="https://github.com/aasanchez" class="hover:underline">aasanchez</a>. All Rights Reserved.
</span>
<ul class="flex flex-wrap items-center mt-3 text-sm font-medium text-gray-500 dark:text-gray-400 sm:mt-0">
<li>
<a href="https://github.com/aasanchez/unixy2k" class="text-gray-400 hover:text-gray-900 dark:hover:text-white">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd" />
</svg>
<span class="sr-only">SourceCode</span>
</a>
</li>
</ul>
</footer>
<script>
function updateDate() {
const currentDate = new Date();
const utcDate = currentDate.toISOString().slice(0, 19).replace('T', ' ');
const epochTime = Math.floor(currentDate.getTime() / 1000);
// Convert epoch time to a binary string and split into 8-bit chunks
const binaryString = epochTime.toString(2).padStart(32, '0'); // Ensures at least 32 bits
const binaryChunks = binaryString.match(/.{1,8}/g);
// Update the date, epoch time, and binary representation in the document
document.getElementById("current-date").textContent = `Date: ${utcDate}`;
document.getElementById("epoch-time").textContent = `Epoch Time: ${epochTime}`;
document.getElementById("epoch-binary").textContent = `Binary: ${binaryChunks.join(' ')}`;
// Calculate the remaining time until 2038-01-19 03:14:07 UTC
const targetDateEpoch = 2147483647; // Pre-calculated epoch time for 2038-01-19T03:14:07Z
const remainingTime = targetDateEpoch - epochTime;
// Time units in seconds
const secondsInMinute = 60;
const secondsInHour = 60 * secondsInMinute;
const secondsInDay = 24 * secondsInHour;
const secondsInYear = 365.25 * secondsInDay; // Account for leap years
const secondsInMonth = secondsInYear / 12;
// Calculate remaining time in years, months, days, hours, minutes, and seconds
const years = Math.floor(remainingTime / secondsInYear);
const months = Math.floor((remainingTime % secondsInYear) / secondsInMonth);
const days = Math.floor((remainingTime % secondsInMonth) / secondsInDay);
const hours = Math.floor((remainingTime % secondsInDay) / secondsInHour);
const minutes = Math.floor((remainingTime % secondsInHour) / secondsInMinute);
const seconds = remainingTime % secondsInMinute;
// Format and update the remaining time in the document
const remainingTimeString = `${years} years, ${months} months, ${days} days, ${hours} hours, ${minutes} minutes, ${seconds} seconds`;
document.getElementById("remaining-time").textContent = remainingTimeString;
}
setInterval(updateDate, 100);
</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7798997524767068" crossorigin="anonymous"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P4QTHHP1XX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-P4QTHHP1XX');
</script>
</body>
</html>