erisian time calculation algorithm is accelerated several times faster

This commit is contained in:
ivan 2024-06-12 11:22:53 +03:00
parent 5657b28280
commit c84417fc66
2 changed files with 8 additions and 10 deletions

View File

@ -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

View File

@ -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];