erisian time calculation algorithm is accelerated several times faster
This commit is contained in:
parent
5657b28280
commit
c84417fc66
|
@ -9,4 +9,4 @@ 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
|
||||
https://discordia.fandom.com/wiki/Erisian_Time
|
16
dtime.js
16
dtime.js
|
@ -92,17 +92,15 @@ function dtime(gregorianDate,resultar="default") {
|
|||
} 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);
|
||||
|
||||
var christianMSDay = date.valueOf() % 86400000;
|
||||
var ds = (1 / (864 / christianMSDay));
|
||||
var h = Math.floor(ds/10000);
|
||||
ds%= 10000;
|
||||
m = Math.floor(ds/100);
|
||||
var m = Math.floor(ds/100);
|
||||
ds%= 100;
|
||||
s = ds;
|
||||
var s = Math.floor(ds);
|
||||
|
||||
switch (resultar) {
|
||||
case "shortsec":
|
||||
return [ddatestr, h+":"+az(m), ":"+az(s), ddaystr];
|
||||
|
|
Loading…
Reference in New Issue