40 lines
891 B
C++
40 lines
891 B
C++
#ifndef NALOGA0301_TIME_H
|
|
#define NALOGA0301_TIME_H
|
|
|
|
#include <string>
|
|
|
|
/*#define MAX_HOUR 24
|
|
#define NOON_HOUR 12*/
|
|
|
|
class Time {
|
|
private:
|
|
unsigned int hour, minute, second;
|
|
public:
|
|
const static unsigned int MAX_HOUR = 24;
|
|
const static unsigned int NOON_HOUR = 12;
|
|
|
|
Time();
|
|
|
|
explicit Time(unsigned int hour);//time(hour,0,0);
|
|
|
|
Time(unsigned int hour, unsigned int minute, unsigned int second);
|
|
|
|
std::string toString() const;
|
|
|
|
std::string toString12HourFormat() const;
|
|
|
|
static bool isTimeValid(unsigned int hour, unsigned int minute, unsigned int second);
|
|
|
|
static Time parse(const std::string &time);
|
|
|
|
static const Time *maxTime(const Time *time1, const Time *time2);
|
|
|
|
unsigned int getHour() const;
|
|
|
|
unsigned int getMinute() const;
|
|
|
|
unsigned int getSecond() const;
|
|
};
|
|
|
|
#endif //NALOGA0301_TIME_H
|