Commit 9bb3230f authored by Eric Walsh's avatar Eric Walsh

autosave

parent 9bd4329e
......@@ -102,10 +102,14 @@ double julian(double year, double hours){
}
days += dayWhole;
hoursLeft = dayFract * 24;//counts the left over hours that aren't days
if(hoursLeft >= 12){ //turns the left over hours into seconds since noon (12pm)
seconds = (hoursLeft - 12) * 360;
if(hoursLeft != 0){
if(hoursLeft >= 12) { //turns the left over hours into seconds since noon (12pm)
seconds = (hoursLeft - 12) * 360;
} else {
seconds = (hoursLeft + 12) * 360;
}
} else {
seconds = (hoursLeft + 12) * 360;
//seconds = 43200;
}
if(DEBUG){
clog << "DEBUG: Days has a value of " << days << " hoursLeft has a value of " << hoursLeft << " while seconds has value of: " << seconds << endl;
......@@ -119,17 +123,19 @@ double julian(double year, double hours){
double GMST(int year, double hours){
//JD is the julian date (days since jan 1st, 4713 BC) and D is days since Jan 1st 2000
double D, GMST, temp, JD0;
double hoursLeft = modf((hours/24), &temp) * 24; // hours since the previous midnight
//double hoursLeft = modf((hours/24), &temp) * 24; // hours since the previous midnight
//hoursLeft = (hoursLeft + 12);
double JD = julian(year, hours);
//double JDmin = floor(JD) - 0.5;
//double JDmax = floor(JD) + 0.5;
JD0 = JD - (hoursLeft / 24);
JD0 = floor(JD) + 0.5;
D = ( JD - 2451545.0);
double D0 = JD0 - 2451545.0;
double T = D/36525; // centuries since Jan 1st 2000 AD
double hoursLeft = (JD -JD0) *24;
if(DEBUG){
clog << "DEBUG: The GMST in days is: " << D << endl
clog << fixed << setprecision(10) << "DEBUG: The GMST in days is: " << D << endl
<< "DEBUG: The value of JD is: " << JD << endl
<< "DEBUG: The value of JD0 is: " << JD0 << " and the value of D0 " << D0 << endl;
}
temp = 6.697374558 + (0.06570982441908*D0) + (1.00273790935*hoursLeft) + (0.000026 * pow(T, 2));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment