Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,10 @@ private BigDecimal multiplyBy(BigDecimal multiplicand, BigDecimal multiplier) {
}

private BigDecimal divideBy(BigDecimal dividend, BigDecimal divisor) {
return dividend.divide(divisor, 4, RoundingMode.HALF_EVEN);
return dividend.divide(divisor, 8, RoundingMode.HALF_EVEN);
}

private BigDecimal setScale(BigDecimal number) {
return number.setScale(4, RoundingMode.HALF_EVEN);
return number.setScale(8, RoundingMode.HALF_EVEN);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static org.junit.Assert.assertEquals;

import java.util.Calendar;
import java.util.TimeZone;

import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -97,6 +98,20 @@ public void testSpecificDateLocationAndTimezone() {
assertEquals(6, officialSunriseCalendarForDate.get(Calendar.DAY_OF_MONTH));
}

@Test
public void testSpecificDateLocationAndTimezone2() {
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);
}

@Test
public void testNonIntegerTimezoneOffset() {
Location loc = new Location("22.56", "88.36");
Expand Down
2 changes: 1 addition & 1 deletion testdata/55_03N-82_91E#GMT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
6/29/2012,99:99,99:99,20:55,21:52,15:11,16:08,99:99,99:99
6/30/2012,99:99,99:99,20:56,21:53,15:11,16:08,99:99,99:99
7/01/2012,99:99,99:99,20:57,21:54,15:10,16:07,99:99,99:99
7/02/2012,99:99,99:99,20:58,21:55,15:10,16:07,18:31,99:99
7/02/2012,99:99,99:99,20:58,21:55,15:10,16:07,18:28,99:99
7/03/2012,99:99,18:45,20:59,21:56,15:09,16:06,18:15,99:99
7/04/2012,99:99,18:54,21:00,21:57,15:09,16:05,18:08,99:99
7/05/2012,99:99,19:01,21:02,21:58,15:08,16:04,18:02,99:99
Expand Down