-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclocks.cpp
More file actions
184 lines (143 loc) · 2.57 KB
/
clocks.cpp
File metadata and controls
184 lines (143 loc) · 2.57 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#include "clocks.h"
#include <ctime>
#include "outlib.h"
Time::Time()
{
this->hours = 0;
this->minutes = 0;
this->seconds = 0;
};
Time::~Time()
{
};
bool operator == (Time &time1, Time &time2)
{
if (time1.hours == time2.hours)
{
if (time1.minutes == time2.minutes)
{
if (time1.seconds == time2.seconds)
{
return true;
};
};
};
return false;
};
bool operator != (Time &time1, Time &time2)
{
return !(time1 == time2);
};
TimeFinder::TimeFinder()
{
this->hours = 0;
this->minutes = 0;
this->seconds = 0;
};
TimeFinder::~TimeFinder()
{
};
Time TimeFinder::findTime()
{
time_t result = time(NULL);
char str[26];
ctime_s(str, sizeof str, &result);
string strr = str;
Time answer;
answer.setHours(atoi(strr.substr(11, 2).c_str()));
answer.setMinutes(atoi(strr.substr(14, 2).c_str()));
answer.setSeconds(atoi(strr.substr(17, 2).c_str()));
return answer;
};
SkyNet::SkyNet()
{
};
SkyNet::~SkyNet()
{
delete device;
};
void SkyNet::setStrategy(IATA* _device)
{
this->device = _device;
};
Time SkyNet::getAnswer()
{
Time answer;
device->countTime();
answer = device->getTime();
return answer;
};
IATA::IATA()
{
};
IATA::~IATA()
{
};
Time IATA::getTime()
{
Time answer;
answer.setHours(this->hours);
answer.setMinutes(this->minutes);
answer.setSeconds(this->seconds);
return answer;
};
DeLorean::DeLorean()
{
this->hours = 0;
this->minutes = 0;
this->seconds = 0;
};
DeLorean::~DeLorean()
{
};
/*I'm dissapointed. That's not the algorithm that I want. I'm just so stupid to do it*/
void DeLorean::countTime()
{
TimeFinder timeFinder;
Time time;
int timePeriod = 23;
time = timeFinder.findTime();
this->hours = time.getHours();
this->minutes = time.getMinutes();
this->seconds = time.getSeconds();
if (this->hours == 0) this->hours +=24 ;
this->hours += timePeriod;
this->hours -= 24;
};
T800::T800()
{
this->hours = 0;
this->minutes = 0;
this->seconds = 0;
};
T800::~T800()
{
};
void T800::countTime()
{
TimeFinder timeFinder;
Time now, then;
OutManager outManager;
now = timeFinder.findTime();
this->hours = now.getHours();
this->minutes = now.getMinutes();
this->seconds = now.getSeconds();
int steps = 0;
int i = 0;
steps = 60 * 60 * 23;
float one_percent = steps / 100;
/*It works like donkey. We arrived? We arrived? We arrived?*/
while (i < steps)
{
then = timeFinder.findTime();
if (then != now)
{
now = timeFinder.findTime();
this->hours = now.getHours();
this->minutes = now.getMinutes();
this->seconds = now.getSeconds();
i++;
outManager.terminatorOut(i, one_percent);
};
};
};