mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-05-24 08:45:55 -04:00
Skip 6 days (instead of 1) to find next moon quarter.
This should help find the next quarter slightly more efficiently because it will provide a more accurate estimate of the next quarter.
This commit is contained in:
@@ -61,8 +61,9 @@ rm -f output/vsop_*.txt temp/*
|
||||
./generate all || Fail "Could not generate target code."
|
||||
|
||||
echo ""
|
||||
echo "Validating JavaScript code."
|
||||
echo "Running astro_check."
|
||||
node astro_check.js > temp/check.txt || Fail "Problem running JavaScript unit test."
|
||||
echo "Verifying astro_check output."
|
||||
./generate check temp/check.txt || Fail "Verification failure for JavaScript unit test output."
|
||||
|
||||
echo ""
|
||||
|
||||
@@ -1279,13 +1279,12 @@ Astronomy.SearchMoonQuarter = function(dateStart) {
|
||||
let quarterStart = Math.floor(phaseStart / 90);
|
||||
let quarter = (quarterStart + 1) % 4;
|
||||
let time = Astronomy.SearchMoonPhase(90 * quarter, dateStart, 10);
|
||||
if (!time) return null;
|
||||
return { quarter:quarter, time:time };
|
||||
return time && { quarter:quarter, time:time };
|
||||
}
|
||||
|
||||
Astronomy.NextMoonQuarter = function(mq) {
|
||||
// Skip one day past the previous found moon quarter to find the next one.
|
||||
let date = new Date(mq.time.date.getTime() + millis_per_day);
|
||||
// Skip 6 days past the previous found moon quarter to find the next one.
|
||||
let date = new Date(mq.time.date.getTime() + 6*millis_per_day);
|
||||
return Astronomy.SearchMoonQuarter(date);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,4 +5,4 @@ if ! git diff-files --quiet --ignore-submodules; then
|
||||
exit 1
|
||||
fi
|
||||
echo "verify_clean: OK"
|
||||
exit 0
|
||||
exit 0
|
||||
|
||||
@@ -2116,13 +2116,12 @@ Astronomy.SearchMoonQuarter = function(dateStart) {
|
||||
let quarterStart = Math.floor(phaseStart / 90);
|
||||
let quarter = (quarterStart + 1) % 4;
|
||||
let time = Astronomy.SearchMoonPhase(90 * quarter, dateStart, 10);
|
||||
if (!time) return null;
|
||||
return { quarter:quarter, time:time };
|
||||
return time && { quarter:quarter, time:time };
|
||||
}
|
||||
|
||||
Astronomy.NextMoonQuarter = function(mq) {
|
||||
// Skip one day past the previous found moon quarter to find the next one.
|
||||
let date = new Date(mq.time.date.getTime() + millis_per_day);
|
||||
// Skip 6 days past the previous found moon quarter to find the next one.
|
||||
let date = new Date(mq.time.date.getTime() + 6*millis_per_day);
|
||||
return Astronomy.SearchMoonQuarter(date);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user