Easter Island winter time binding and separating of files

This commit is contained in:
ivan 2020-03-04 17:46:16 +03:00
parent 4df8ec6b0e
commit 745110f8c6
4 changed files with 176 additions and 175 deletions

View File

@ -2,3 +2,11 @@
dtime - Erisian (Discordian) time and date dtime - Erisian (Discordian) time and date
based on REAL-TIME CLOCK by Tiago Madeira based on REAL-TIME CLOCK by Tiago Madeira
Discordian date:
https://en.wikipedia.org/wiki/Discordian_calendar
Discordian time is the decimal time without time zones, where the
beginning of the day coincides with the beginning of the Christian
winter day on Easter Island (UTC-5):
https://en.wikipedia.org/wiki/Decimal_time

31
dtime.css Normal file
View File

@ -0,0 +1,31 @@
* {
margin:0;
padding:0;
}
html {
width:100%;
height:100%;
position:relative;
background:#f1f1f1;
color:#326f0c;
font-size: 55px;
}
#wrap {
position:absolute;
text-align:center;
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
}
#ddate {
text-transform:uppercase;
}
#dtime {
font-size: 305%;
}

125
dtime.js Normal file
View File

@ -0,0 +1,125 @@
/*
* https://gitlab.com/zlax/dtime-js
* based on:
*
* REAL-TIME CLOCK (c) 2009 por Tiago Madeira (http://tiagomadeira.com/)
* Idealizado por Santaum (http://santaum.org/)
*
* All Hail Eris!
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function az(x) {
if (x < 10)
return "0"+x;
return x;
}
function ly(Y) {
return (Y % 4 == 0 && !(Y % 100 == 0 && Y % 400 != 0));
}
function dy(D, M, Y) {
var dm = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (ly(Y)) {
dm[1] = 29;
}
var d = D;
for (var i = 0; i < M-1; i++) {
d+= dm[i]
}
return d;
}
function dtime(gregorianDate) {
// Easter Island Winter Time Zone offset (-5*60*60*1000)
var date = new Date(gregorianDate.getTime()-18000000);
var D = date.getUTCDate();
var M = date.getUTCMonth()+1;
var Y = date.getUTCFullYear();
var d = dy(D, M, Y);
var sttiby = 0;
if (ly(Y)) {
if (d == 60) {
sttiby = 1;
} else if (d > 60) {
d--;
}
}
M = Math.floor(d/73);
D = d % 73;
if (D == 0) {
M--;
D = 73;
}
switch (M) {
case 0:
M = "Chaos";
break;
case 1:
M = "Discord";
break;
case 2:
M = "Confusion";
break;
case 3:
M = "Bureaucracy";
break;
case 4:
M = "Aftermath";
break;
default:
M = "fnord";
}
Y+= 1166;
if (sttiby) {
var ddatestr = "St. Tib's Day, "+Y+" YOLD";
} else {
var ddatestr = M+" "+az(D)+", "+Y+" YOLD";
}
var h = date.getUTCHours();
var m = date.getUTCMinutes();
var s = date.getUTCSeconds();
var ms = date.getUTCMilliseconds();
var e = h*3600000+m*60000+s*1000+ms;
var ds = Math.round(e/864);
h = Math.floor(ds/10000);
ds%= 10000;
m = Math.floor(ds/100);
ds%= 100;
s = ds;
var dtimestr = az(h)+":"+az(m)+":"+az(s);
return [ddatestr, dtimestr];
}
function go() {
var iddate = document.getElementById("ddate");
var idtime = document.getElementById("dtime");
// Current date-time with any time zone offset
var ddatetime = new Date();
ddatetime = dtime(ddatetime);
iddate.innerHTML = ddatetime[0];
idtime.innerHTML = ddatetime[1];
}
window.onload = function() {
go();
// 1 discordian decimal second = 864 christian milliseconds
setInterval(go, 864);
}

View File

@ -1,174 +1,11 @@
<!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN" <!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head>
<!-- https://gitlab.com/zlax/dtime-js discrodian date and time -->
<!-- <link rel="stylesheet" type="text/css" href="dtime.css">
REAL-TIME CLOCK (c) 2009 por Tiago Madeira (http://tiagomadeira.com/) <script type="text/javascript" src="dtime.js"></script>
Idealizado por Santaum (http://santaum.org/) </head>
<div id="wrap">
All Hail Eris! <p id="ddate">Need javascript enabled</p>
<p id="dtime">00:00:00</p>
This program is free software: you can redistribute it and/or modify </div>
it under the terms of the GNU General Public License as published by </html>
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script type="text/javascript">
function az(x) {
if (x < 10)
return "0"+x;
return x;
}
function ly(Y) {
return (Y % 4 == 0 && !(Y % 100 == 0 && Y % 400 != 0));
}
function dy(D, M, Y) {
var dm = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (ly(Y)) {
dm[1] = 29;
}
var d = D;
for (var i = 0; i < M-1; i++) {
d+= dm[i]
}
return d;
}
function go() {
var iddate = document.getElementById("ddate");
var idtime = document.getElementById("dtime");
var date = new Date();
var D = date.getDate();
var M = date.getMonth()+1;
var Y = date.getFullYear();
var d = dy(D, M, Y);
var sttiby = 0;
if (ly(Y)) {
if (d == 60) {
sttiby = 1;
} else if (d > 60) {
d--;
}
}
M = Math.floor(d/73);
D = d % 73;
if (D == 0) {
M--;
D = 73;
}
switch (M) {
case 0:
M = "Caos";
break;
case 1:
M = "DiscÃ&#179;rdia";
break;
case 2:
M = "ConfusÃ&#163;o";
break;
case 3:
M = "Burocracia";
break;
case 4:
M = "Consequências";
break;
default:
M = "fnord";
}
Y+= 1166;
if (sttiby) {
iddate.innerHTML = "Dia de SÃ&#163;o Tiby, "+Y+" YOLD";
} else {
iddate.innerHTML = az(D)+" de "+M+" de "+Y+" YOLD";
}
var h = date.getHours();
var m = date.getMinutes();
var s = date.getSeconds();
var e = h*3600+m*60+s;
var ds = Math.round(e*1000/864);
h = Math.floor(ds/10000);
ds%= 10000;
m = Math.floor(ds/100);
ds%= 100;
s = ds;
idtime.innerHTML = az(h)+":"+az(m)+":"+az(s);
}
window.onload = function() {
go();
setInterval(go, 100);
}
</script>
<style type="text/css">
* {
margin:0;
padding:0;
}
html {
width:100%;
height:100%;
position:relative;
background:#f1f1f1;
color:#326f0c;
font:14px "Luxi Sans", "Lucida Sans", "Trebuchet MS", "Bitstream Vera Sans", serif;
}
#wrap {
position:absolute;
width:240px;
height:100px;
/* left:50%; */
/* top:50%; */
margin-top:5px;
text-align:center;
}
#ddate {
text-transform:uppercase;
}
#dtime {
font:40px "Bitstream Vera Sans Mono", "Courier New", monospace;
}
#license {
position:absolute;
bottom:5px;
left:50%;
margin-left:-300px;
width:600px;
text-align:center;
font-size:0.8em;
line-height:1.4em;
}
a {
color:#aaa;
text-decoration:underline;
}
a:hover {
text-decoration:none;
}
</style>
<div id="wrap">
<p id="ddate">Ative o JavaScript.</p>
<p id="dtime">00:00:00</p>
</div>
<br /><br /><br /><br /><br />
</!doctype>