From 35e930c12f8b669827ad1f9798e7059145a63f00 Mon Sep 17 00:00:00 2001 From: lsiepel Date: Tue, 27 Dec 2022 12:56:43 +0100 Subject: [PATCH] [astro] Added moon phase precision (#14067) * 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..2787c5afe7c46 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