-
Notifications
You must be signed in to change notification settings - Fork 0
/
TimeSpan.h
56 lines (42 loc) · 1.45 KB
/
TimeSpan.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include <iostream>
using namespace std;
class TimeSpan
{
friend ostream& operator<<(std::ostream &out, const TimeSpan &time);
friend istream& operator>>(std::istream &in, TimeSpan &time);
public:
TimeSpan();
TimeSpan(float hour, float min, float sec);
TimeSpan(float min, float sec);
TimeSpan(float sec);
//TimeSpan(const TimeSpan &newTime);
int getHours() const;
int getMinutes() const;
int getSeconds() const;
TimeSpan operator=(const TimeSpan &time);
TimeSpan TimeSpan::operator-();
TimeSpan operator*(const TimeSpan &time) const;
TimeSpan operator+(const TimeSpan &time) const;
TimeSpan operator-(const TimeSpan &time) const;
TimeSpan operator/(const TimeSpan &time) const;
TimeSpan& operator+=(const TimeSpan &time);
TimeSpan& operator-=(const TimeSpan &time);
TimeSpan& operator*=(const TimeSpan &time);
TimeSpan& operator/=(const TimeSpan &time);
bool operator==(const TimeSpan &time) const;
bool operator!=(const TimeSpan &time) const;
bool operator<=(const TimeSpan &time) const;
bool operator>=(const TimeSpan &time) const;
bool operator<(const TimeSpan &time) const;
bool operator>(const TimeSpan &time) const;
bool setTime(int hours, int minutes, int seconds);
// void operator++(); not clear
// void operator--();
~TimeSpan();
private:
int hours = NULL;
int minutes = NULL;
int seconds = NULL;
void ConfigureTimeClock(float hours, float min, float sec);
};