Open JCDubs opened 8 years ago
I plugged your location, TZ, and date into my test harness and got the same bad result: 03:32. I'll have to debug this to determine what's going wrong.
-Mike
Thanks @mikereedell
I had also problem with sunrise time (almost 6 hours difference). It comes from tan(x) calculations. Increasing scale from 4 to 8 helped in my case (SolarEventCalculator.java). Hope it will help.
private BigDecimal divideBy(BigDecimal dividend, BigDecimal divisor) {
return dividend.divide(divisor, 8, RoundingMode.HALF_EVEN);
}
private BigDecimal setScale(BigDecimal number) {
return number.setScale(8, RoundingMode.HALF_EVEN);
}
Cheers kwojtas. I will give it a go.
This pull request applies this mentioned fix #44
Hi Mike,
I am trying to get the sunrise time for today using your calculator. I have looked at a couple of sources to get the official sunrise time for today and all confirm the time to be about 5:32 AM. When I run the calculator with the same date and location it produces a sunrise time exactly 2 hours behind (3:32AM). The code and setup is as follows:
Does the above code look correct to you? Can you think of any reasons why this would happen with the above code?