Skip to content

Commit

Permalink
[astro] Added moon phase precision (openhab#14067)
Browse files Browse the repository at this point in the history
* add more precision to MoonPhase.Age

Signed-off-by: lsiepel <[email protected]>
  • Loading branch information
lsiepel authored and borazslo committed Jan 8, 2023
1 parent cd494ce commit e6f64e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private void setMoonPhase(Calendar calendar, Moon moon) {
double julianDateEndOfDay = DateTimeUtils.endOfDayDateToJulianDate(calendar);
double parentNewMoon = getPreviousPhase(calendar, julianDateEndOfDay, NEW_MOON);
double age = Math.abs(parentNewMoon - julianDateEndOfDay);
phase.setAge((int) age);
phase.setAge(age);

long parentNewMoonMillis = DateTimeUtils.toCalendar(parentNewMoon).getTimeInMillis();
long ageRangeTimeMillis = phase.getNew().getTimeInMillis() - parentNewMoonMillis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class MoonPhase {
private Calendar full;
private Calendar thirdQuarter;
private Calendar _new;
private int age;
private double age;
private double illumination;
private double agePercent;
private double ageDegree;
Expand Down Expand Up @@ -105,7 +105,7 @@ public QuantityType<Time> getAge() {
/**
* Sets the age in days.
*/
public void setAge(int age) {
public void setAge(double age) {
this.age = age;
}

Expand Down

0 comments on commit e6f64e0

Please sign in to comment.