//Static methods /////////////////////////////// Implementation //////////////////////////////// public static double MeanGreenwichSiderealTime(double JD) { //Get the Julian day for the same day at midnight int Year = 0; int Month = 0; int Day = 0; int Hour = 0; int Minute = 0; double Second = 0; CAADate date = new CAADate(); date.Set(JD, CAADate.AfterPapalReform(JD)); date.Get(ref Year, ref Month, ref Day, ref Hour, ref Minute, ref Second); date.Set(Year, Month, Day, 0, 0, 0, date.InGregorianCalendar()); double JDMidnight = date.Julian(); //Calculate the sidereal time at midnight double T = (JDMidnight - 2451545) / 36525; double TSquared = T * T; double TCubed = TSquared * T; double Value = 100.46061837 + (36000.770053608 * T) + (0.000387933 * TSquared) - (TCubed / 38710000); //Adjust by the time of day Value += (((Hour * 15) + (Minute * 0.25) + (Second * 0.0041666666666666666666666666666667)) * 1.00273790935); Value = CAACoordinateTransformation.DegreesToHours(Value); return(CAACoordinateTransformation.MapTo0To24Range(Value)); }
public static int DaysInYear(int Year) { //Find the previous civil year corresponding to the specified jewish year int CivilYear = Year - 3761; //Find the date of the next Jewish Year in that civil year CAACalendarDate CurrentPesach = DateOfPesach(CivilYear); bool bGregorian = CAADate.AfterPapalReform(CivilYear, CurrentPesach.Month, CurrentPesach.Day); CAADate CurrentYear = new CAADate(CivilYear, CurrentPesach.Month, CurrentPesach.Day, bGregorian); CAACalendarDate NextPesach = DateOfPesach(CivilYear + 1); CAADate NextYear = new CAADate(CivilYear + 1, NextPesach.Month, NextPesach.Day, bGregorian); return((int)(NextYear - CurrentYear)); }
//Static methods ////////////////////////////////// Implementation ///////////////////////////// public static double DeltaT(double JD) { //Construct a CAADate from the julian day CAADate date = new CAADate(JD, CAADate.AfterPapalReform(JD)); double y = date.FractionalYear(); double T = (y - 2000) / 100; double Delta; if (y < 948) { Delta = 2177 + (497 * T) + (44.1 * T * T); } else if (y < 1620) { Delta = 102 + (102 * T) + (25.3 * T * T); } else if (y < 1998) { int Index = (int)((y - 1620) / 2); Debug.Assert(Index < GlobalMembersStdafx.DeltaTTable.Length); y = y / 2 - Index - 810; Delta = (GlobalMembersStdafx.DeltaTTable[Index] + (GlobalMembersStdafx.DeltaTTable[Index + 1] - GlobalMembersStdafx.DeltaTTable[Index]) * y); } else if (y <= 2000) { int nLookupSize = GlobalMembersStdafx.DeltaTTable.Length; Delta = GlobalMembersStdafx.DeltaTTable[nLookupSize - 1]; } else if (y < 2100) { Delta = 102 + (102 * T) + (25.3 * T * T) + 0.37 * (y - 2100); } else { Delta = 102 + (102 * T) + (25.3 * T * T); } return(Delta); }