decimalTime/index.html
2023-03-06 15:01:51 -06:00

116 lines
4 KiB
HTML

<html>
<head>
<title>Decimal Time Test</title>
<meta name="viewport" content="width=device-width; initial-scale:1.0;">
<style type="text/css">
body {
font-size: 1em;
font-family: "DejaVu Sans", sans-serif;
}
.display, h1, h2, h3 {
text-align: center;
}
#timeSpan, #localTimeSpan, #legacyTimeSpan {
font-family: monospace;
font-size: 1.5em;
}
</style>
</head>
<body>
<div class="display">
<h1>Decimal Time</h1>
<h2>Worldwide decimal time:</h2>
<p id="timeSpan">(loading)</p>
<h2>Local decimal time:</h2>
<p id="localTimeSpan">(loading)</p>
<h3>For reference, the current legacy time is:</h3>
<p id="legacyTimeSpan">(loading)</p>
<h3>This page updates every centimilliday (0.864 seconds)</h3>
</div>
<hr/>
<h2>What is decimal time?</h2>
<p>Decimal time is a method to write and display a date and time
in decimal notation, either worldwide or local based on legacy
timezones.</p>
<ul>
<li>Years are counted from the Unix Epoch (Jan. 1st, 1970
in legacy time).</li>
<li>Time is counted by number of days (counting from zero)
elapsed during the year, plus the decimal fragment of day
already elapsed up to five decimal digits (deciday,
centiday, milliday, decimilliday, centimilliday
respectively).</li>
<li>As of yet, decimal time has been only implemented for
terrestrial dates, hence the T suffix after the year.</li>
<li>Worldwide time is indicated by an M suffix, while local
timezones use a L prefix followed by the amount of offset
that must be added or substracted in decimal time to reach
legacy UTC.</li>
</ul>
</body>
<script src="decimalTime.js"></script>
<script>
//@license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt
/*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright (C) 2013 Carlos Solís
*
* The JavaScript code in this page is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* Affero General Public License (GNU AGPL) as published by the Free
* Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* The code is distributed WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU AGPL for more details.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU AGPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/
var displayTime = function() {
var d = new Date();
/*
var m = d.getMilliseconds();
if (m <= 100) {
if (m <= 10) {
if (m == 0) {
m = "000";
} else {
m = "00"+m;
}
} else {
m = "0" +m;
}
}
*/
if (document.getElementById('timeSpan').innerHTML != decimalTime() ){
document.getElementById('timeSpan').innerHTML = decimalTime();
}
if (document.getElementById('localTimeSpan').innerHTML != decimalTime(d, true) ) {
document.getElementById('localTimeSpan').innerHTML = decimalTime(d, true);
}
//document.getElementById('legacyTimeSpan').innerHTML = new Date() + " + " + m + " ms";
if (document.getElementById('legacyTimeSpan').innerHTML != new Date() ){
document.getElementById('legacyTimeSpan').innerHTML = new Date();
}
};
//Autostart
var starter = function(){
//window.setInterval(displayTime, 864); //Every centimilliday
window.setInterval(displayTime, 1);
};
window.onload = starter(); //document.addEventListener('DOMContentLoaded',starter);
//@license-end
</script>
</html>