]> git.basschouten.com Git - openhab-addons.git/commitdiff
[astro] Added moon phase precision (#14067)
authorlsiepel <leosiepel@gmail.com>
Tue, 27 Dec 2022 11:56:43 +0000 (12:56 +0100)
committerGitHub <noreply@github.com>
Tue, 27 Dec 2022 11:56:43 +0000 (12:56 +0100)
* add more precision to MoonPhase.Age

Signed-off-by: lsiepel <leosiepel@gmail.com>
bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/calc/MoonCalc.java
bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/model/MoonPhase.java

index b20a60148d51c69cde4f0d0d847cc6590937daaa..0cde817c1924c7a8aa57e0458823f59c2f43371c 100644 (file)
@@ -121,7 +121,7 @@ public class MoonCalc {
         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;
index 435c77918498a6b414cce19d4ddede5eb2155b24..2787c5afe7c466f7be271f42545657e8b134f282 100644 (file)
@@ -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;
@@ -105,7 +105,7 @@ public class MoonPhase {
     /**
      * Sets the age in days.
      */
-    public void setAge(int age) {
+    public void setAge(double age) {
         this.age = age;
     }