-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTime.cpp
More file actions
44 lines (37 loc) · 932 Bytes
/
Time.cpp
File metadata and controls
44 lines (37 loc) · 932 Bytes
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
#include "Time.hpp"
void Time::setPeriodSecond(unsigned long second) {
this->period = second;
}
void Time::setPeriodMinute(unsigned long minute) {
if (minute < MAX_PERIOD_SECONDS/60) {
this->period = minute * 60;
} else {
this->period = MAX_PERIOD_SECONDS;
}
}
void Time::setPeriodHour(unsigned long hour) {
if (hour < MAX_PERIOD_SECONDS/3600) {
this->period = hour * 3600;
} else {
this->period = MAX_PERIOD_SECONDS;
}
}
void Time::setPeriodDay(unsigned long day) {
if (day <= MAX_PERIOD_DAYS) {
this->period = this->DAY_SECONDS * day;
} else {
this->period = MAX_PERIOD_DAYS;
}
}
void Time::setPeriodYear(unsigned long year) {
if (year <= MAX_PERIOD_YEARS) {
this->period = this->YEAR_SECONDS * year;
} else {
this->period = MAX_PERIOD_YEARS;
}
}
Time::Time(){
}
Time::Time(unsigned long period_in_second){
this->setPeriodSecond(period_in_second);
}