mikereedell / sunrisesunsetlib-java

Library for computing the sunrise/sunset from GPS coordinates and a date, in Java.
http://mikereedell.github.com/sunrisesunsetlib-java/
Apache License 2.0
299 stars 69 forks source link

Fix rounding error of sunrise sunset time by changing the tan(x) calc… #44

Open Kneke opened 2 years ago

Kneke commented 2 years ago

…ulations of the SolarEventCalculator

Example for a wrong sunset time with an offset of two hours would be: Location erdingGermany = new Location(48.3107657, 11.8759098); TimeZone timeZone = TimeZone.getTimeZone("Europe/Berlin"); SunriseSunsetCalculator calculator = new SunriseSunsetCalculator(erdingGermany, timeZone);

           Calendar calendar = Calendar.getInstance();
           calendar.set(2022, Calendar.JUNE, 21);

           String resultAsString = calculator.getOfficialSunsetForDate(calendar);

           assertEquals("21:17", resultAsString); // But was 15:17
Kneke commented 2 years ago

PR for this issue #14