We're updating the issue view to help you get more done. 

Bug in CalendarAstronomer in sunset time

Description

There appears to be a bug in CalendarAstronomer when generating the sunset
times.
For some dates, it appears to be generating incorrect sunset times that are a
few minutes ahead of the actual sunset times.
Here is some test code that I was using.
import com.ibm.util.CalendarAstronomer;
import java.util.*;
import java.text.*;

public class SunriseTest
{
public static void main (String[] args)
{
System.out.println("Sunrise/Sunset times for Toronto, Ontario");

CalendarAstronomer astro= new CalendarAstronomer(-79.38, 43.65);
DateFormat df= DateFormat.getTimeInstance();
DateFormat day= DateFormat.getDateInstance(DateFormat.MEDIUM);

Calendar cal= Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, 1);

for (int i=0; i < 30; i++)
{
astro.setDate(cal.getTime());

Date sunrise= new Date(astro.getSunRiseSet(true));
Date sunset= new Date(astro.getSunRiseSet(false));

System.out.println(day.format(cal.getTime()));
System.out.print("Sunrise: " + df.format(sunrise));
System.out.println(" Sunset: " + df.format(sunset));

cal.add(Calendar.DATE, 1);
}
}
}

If you run this program (for april 2001) you will notice that the sunset times
are increasing up until April 17 and then the next day is a decrease of 3
minutes. (Which isn't right as the sunset times should be increasing until June
in this part of the world.)
Here is part of the output:

15-Apr-01
Sunrise: 6:35:27 AM Sunset: 8:05:59 PM
16-Apr-01
Sunrise: 6:33:47 AM Sunset: 8:07:11 PM
17-Apr-01
Sunrise: 6:32:08 AM Sunset: 8:08:22 PM
18-Apr-01
Sunrise: 6:30:30 AM Sunset: 8:05:38 PM
19-Apr-01
Sunrise: 6:28:52 AM Sunset: 8:06:49 PM

As a comparison, I was comparing it to sunrise/set times generated by the
following website.

http://www.hia.nrc.ca/services/sunmoon/

A.F.

Status

Assignee

TracBot

Reporter

TracBot

Labels

Reviewer

None

Time Needed

None

Start date

None

Components

Fix versions

Priority

major