Created
December 12, 2012 16:07
-
-
Save vndmtrx/4269022 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // MAYAN_COUNT_TO_JD -- Determina o dia do Calendário Juliano na Contagem Longa Maia | |
| var MAYAN_COUNT_EPOCH = 584282.5; | |
| function mayan_count_to_jd(baktun, katun, tun, uinal, kin) { | |
| return MAYAN_COUNT_EPOCH + | |
| (baktun * 144000) + | |
| (katun * 7200) + | |
| (tun * 360) + | |
| (uinal * 20) + | |
| kin; | |
| } | |
| // JD_TO_MAYAN_COUNT -- Determina o dia da Contagem Longa Maia no Calendário Juliano | |
| function jd_to_mayan_count(jd) { | |
| var d, baktun, katun, tun, uinal, kin; | |
| jd = Math.floor(jd) + 0.5; | |
| d = jd - MAYAN_COUNT_EPOCH; | |
| baktun = Math.floor(d / 144000); | |
| d = mod(d, 144000); | |
| katun = Math.floor(d / 7200); | |
| d = mod(d, 7200); | |
| tun = Math.floor(d / 360); | |
| d = mod(d, 360); | |
| uinal = Math.floor(d / 20); | |
| kin = mod(d, 20); | |
| return new Array(baktun, katun, tun, uinal, kin); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment