From bb2c25dcdb2f2912f409ca067ec3f0c2849d5d5b Mon Sep 17 00:00:00 2001 From: lsiepel Date: Sat, 24 Dec 2022 14:12:05 +0100 Subject: [PATCH 1/2] add more precision to MoonPhase.Age Signed-off-by: lsiepel --- .../org/openhab/binding/astro/internal/calc/MoonCalc.java | 2 +- .../org/openhab/binding/astro/internal/model/MoonPhase.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/calc/MoonCalc.java b/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/calc/MoonCalc.java index b20a60148d51c..0cde817c1924c 100644 --- a/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/calc/MoonCalc.java +++ b/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/calc/MoonCalc.java @@ -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; diff --git a/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/model/MoonPhase.java b/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/model/MoonPhase.java index 435c77918498a..7dcc3e89e81d7 100644 --- a/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/model/MoonPhase.java +++ b/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/model/MoonPhase.java @@ -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 QuantityType