Commit ed3c6bde authored by Eric Walsh's avatar Eric Walsh

autosave

parent 9bb3230f
......@@ -123,16 +123,21 @@ 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
//hoursLeft = (hoursLeft + 12);
double hoursLeft = modf((hours/24), &temp) * 24; // hours since the previous midnight
//double hoursLeft;
double JD = julian(year, hours);
//double JDmin = floor(JD) - 0.5;
//double JDmax = floor(JD) + 0.5;
JD0 = floor(JD) + 0.5;
D = ( JD - 2451545.0);
D = (JD - 2451545.0);
double D0 = JD0 - 2451545.0;
double T = D/36525; // centuries since Jan 1st 2000 AD
double hoursLeft = (JD -JD0) *24;
//hoursLeft = (JD - JD0) *24;
/*if(JD > JD0){
hoursLeft = (JD - JD0) *24;
} else {
hoursLeft = (JD0 - JD) *24;
}*/
if(DEBUG){
clog << fixed << setprecision(10) << "DEBUG: The GMST in days is: " << D << endl
<< "DEBUG: The value of JD is: " << JD << endl
......
......@@ -32,8 +32,8 @@ int main(){
<< "It actually returns: " << julian(2017, 641.9) << endl;
cout << "if the date is January 1, 2000 at 00:00:00, the GMST date function should return: 6.79519916667." << endl
<< "It actually returns: " << GMST(2000, 0) << endl;
cout << "if the date is January 1, 2019 at 08:00:00, the GMST date function should return: 6.79519916667." << endl
<< "It actually returns: " << GMST(2019, 8) << endl;
//converting time and longitude to phi
/*cout << "if its January 27, 2034, 5:45 pm at a longitude of 49 the, phi should equal 4.65147698949." << endl
<< "Phi actually equals: " << timeToPhi(2034, 641.765166667, 49) << endl;*/
......
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