![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
FINAL PROJECT isn't it
Fork of ELEC351 by
Diff: TIME.cpp
- Revision:
- 34:c0b8705f183d
- Parent:
- 33:3b5096f0126a
- Child:
- 52:99915f5240b2
--- a/TIME.cpp Sun Jan 07 00:45:11 2018 +0000 +++ b/TIME.cpp Sun Jan 07 03:08:00 2018 +0000 @@ -16,6 +16,24 @@ return current_time_global; } +void set_new_date(int days, int months, int years) +{ + time_t Time = time(NULL); + tm* Time_Pointer = localtime(&Time); + set_time(get_current_time() - year*(Time_Pointer->tm_year - 70) + year*(years - 1970)); + set_time(get_current_time() - month*Time_Pointer->tm_mon + month*(months - 1)); + set_time(get_current_time() - day*Time_Pointer->tm_mday + day*days); +} + +void set_new_time(int hours, int minutes, int seconds) +{ + time_t Time = time(NULL); + tm* Time_Pointer = localtime(&Time); + set_time(get_current_time() - second*Time_Pointer->tm_sec + second*seconds); + set_time(get_current_time() - minute*Time_Pointer->tm_min + minute*minutes); + set_time(get_current_time() - hour*Time_Pointer->tm_hour + hour*hours); +} + void Add_Second() //Seconds to Seconds { Time_Lock.lock();