![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Proj 324 Final
Fork of ELEC351_Group_T by
TIME.cpp
- Committer:
- thomasmorris
- Date:
- 2018-01-06
- Revision:
- 31:4a88bf97b53e
- Child:
- 33:3b5096f0126a
File content as of revision 31:4a88bf97b53e:
#include "TIME.hpp" using namespace std; int current_time_global = 0; int new_time = 0; int get_current_time() //Get Current Time { current_time_global = time(0); return current_time_global; } void Add_Second() //Seconds to Seconds { new_time = time(0) + 1; set_time(new_time); } void Subtract_Second() { new_time = time(0) - 1; set_time(new_time); } void Add_Minute() //Minutes to Seconds { new_time = time(0) + 60; set_time(new_time); } void Subtract_Minute() { new_time = time(0) - 60; set_time(new_time); } void Add_Hour() //Hours to Seconds { new_time = time(0) + 3600; set_time(new_time); } void Subtract_Hour() { new_time = time(0) - 3600; set_time(new_time); } void Add_Day() //Days to Seconds { new_time = time(0) + 86400; set_time(new_time); } void Subtract_Day() { new_time = time(0) - 86400; set_time(new_time); } void Add_Month() //Months to Seconds { new_time = time(0) + 2629743; set_time(new_time); } void Subtract_Month() { new_time = time(0) - 2629743; set_time(new_time); } void Add_Year() //Years to Seconds { new_time = time(0) + 31556926; set_time(new_time); } void Subtract_Year() { new_time = time(0) - 31556926; set_time(new_time); } int LCD_Time_Get(string Unit) { int temp_months = 0; int temp_days = 0; int temp_hours = 0; int temp_minutes = 0; int temp_seconds = 0; if(Unit == "Years") { int years = time(0) / year; return (1970 + years); } else if(Unit == "Months") { int temp_months = time(0) / month; int months = (temp_months % 12); return (months + 1); } else if(Unit == "Days") { int temp_days = time(0) / day; int days = fmod(temp_days,Days_In_Month); return (days + 1); } else if(Unit == "Hours") { int temp_hours = time(0) / hour; int hours = temp_hours % 24; return hours; } else if(Unit == "Minutes") { int temp_minutes = time(0) / minute; int minutes = temp_minutes % 60; return minutes; } else if(Unit == "Seconds") { int temp_seconds = time(0) / second; int seconds = temp_seconds % 60; return seconds; } else { cout << "Wrong Input Passed to LCD Time Function" << endl; } }