#define _CRT_SECURE_NO_WARNINGS
#include
#include
#include
#include
#include
#include “utils.h”
#include “Time.h”
using namespace std;
namespace sdds {
bool debug = false; // made global in utils.h
int getTime() {
int mins = -1;
if (debug) {
Time t(0);
cout << "Enter current time: ";
do {
cin.clear();
cin >> t; // needs extraction operator overloaded for Time
if (!cin) {
cout << "Invlid time, try agian (HH:MM): ";
cin.clear();
}
else {
mins = int(t);
}
cin.ignore(1000, '\n');
} while (mins < 0);
}
else {
time_t t = time(NULL);
tm lt = *localtime(&t);
mins = lt.tm_hour * 60 + lt.tm_min;
}
return mins;
}
}