public static LatLonPoint sunPosition(long mssue){
  GregorianCalendar cal=new GregorianCalendar();
  cal.setTime(new Date(mssue));
  double julianDate=calculateJulianDate(cal);
  long gmtOffset=cal.get(Calendar.ZONE_OFFSET);
  long dstOffset=cal.get(Calendar.DST_OFFSET);
  cal.setTime(new Date(mssue - (gmtOffset + dstOffset)));
  double numDaysSinceEpoch=((mssue / 1000) - EPOCH_TIME_SECS) / (24.0f * 3600.0f);
  double M0=sunMeanAnomaly(numDaysSinceEpoch);
  double sunLongitude=sunEclipticLongitude(M0);
  double sunAscension=eclipticToEquatorialAscension(sunLongitude,0.0);
  double sunDeclination=eclipticToEquatorialDeclination(sunLongitude,0.0);
  double tmpAscension=sunAscension - (MoreMath.TWO_PI / 24) * greenwichSiderealTime(julianDate,cal);
  return new LatLonPoint.Double(sunDeclination,tmpAscension,true);
}

public static LatLonPoint sunPosition ( long mssue ) { GregorianCalendar cal = new GregorianCalendar ( ) ; cal . setTime ( new Date ( mssue ) ) ; double julianDate = calculateJulianDate ( cal ) ; long gmtOffset = cal . get ( Calendar . ZONE_OFFSET ) ; long dstOffset = cal . get ( Calendar . DST_OFFSET ) ; cal . setTime ( new Date ( mssue - ( gmtOffset + dstOffset ) ) ) ; double numDaysSinceEpoch = ( ( mssue / 1000 ) - EPOCH_TIME_SECS ) / ( 24.0f * 3600.0f ) ; double M0 = sunMeanAnomaly ( numDaysSinceEpoch ) ; double sunLongitude = sunEclipticLongitude ( M0 ) ; double sunAscension = eclipticToEquatorialAscension ( sunLongitude , 0.0 ) ; double sunDeclination = eclipticToEquatorialDeclination ( sunLongitude , 0.0 ) ; double tmpAscension = sunAscension - ( MoreMath . TWO_PI / 24 ) * greenwichSiderealTime ( julianDate , cal ) ; return new LatLonPoint . Double ( sunDeclination , tmpAscension , true ) ; }
given the number of milliseconds since the unix epoch , compute position on the earth ( lat , lon ) such that sun is directly overhead . from duffett - smith , chapter 46 - 47 .
