Commit 67814aeb authored by Walterio Montanez's avatar Walterio Montanez
Browse files

autosave

parent 01bcc34f
...@@ -175,14 +175,12 @@ pair<double,double> altAndAziPair () { ...@@ -175,14 +175,12 @@ pair<double,double> altAndAziPair () {
} }
double dateToHour (string month, int day, int hour, int minute) { // Converts the date into hours double dateToHour (string month, int year, int day, int hour, int minute) { // Converts the date into hours
//variables //variables
double totHours = 0; double totHours = 0;
int monthNum = 0; int monthNum = 0;
if (month == "January") { // For the number of months before each month in order
if (month == "January") {
monthNum = 0; monthNum = 0;
} else if (month == "February") { } else if (month == "February") {
monthNum = 1; monthNum = 1;
...@@ -207,21 +205,19 @@ double dateToHour (string month, int day, int hour, int minute) { // Converts th ...@@ -207,21 +205,19 @@ double dateToHour (string month, int day, int hour, int minute) { // Converts th
} else { } else {
monthNum = 11; monthNum = 11;
} }
if (month == "January" || month == "March" || month == "May" || month == "July" || month == "August" || month == "October" || month == "December") { if (month == "January" || month == "March" || month == "May" || month == "July" || month == "August" || month == "October" || month == "December") { //Calculates the amount of hours for the months with 31 days
totHours = (monthNum * 744) + ((day - 1) * 24) + (hour - 1) + (minute / 60); totHours = (monthNum * 744) + ((day - 1) * 24) + (hour - 1) + (minute / 60);
} }
else if (month == "April" || month == "June" || month == "September" || month == "November") { else if (month == "April" || month == "June" || month == "September" || month == "November") { // Calculates the hours for the months with 30 days
totHours = (monthNum * 720) + ((day - 1) * 24) + (hour - 1) + (minute / 60); totHours = (monthNum * 720) + ((day - 1) * 24) + (hour - 1) + (minute / 60);
} }
else if (month == "February") { else if (month == "February") {
if (isLeap(year)) { if (isLeap(year)) { // Takes leap year into consideration and calculates the days in February with 29 days
totHours = (monthNum * 696) + ((day - 1) * 24) + (hour - 1) + (minute / 60); totHours = (monthNum * 696) + ((day - 1) * 24) + (hour - 1) + (minute / 60);
} } else if (!isLeap(year)) { // Calculates when February has 28 days
} else if (!isLeap(year)) { totHours = (monthNum * 672) + ((day - 1) * 24) + (hour - 1) + (minute / 60);
totHours = (monthNum * 672) + ((day - 1) * 24) + (hour - 1) + (minute / 60);
}
}
} }
}
return totHours; return totHours;
} }
......
Supports Markdown
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