-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimeTest.cpp
More file actions
29 lines (27 loc) · 806 Bytes
/
Copy pathtimeTest.cpp
File metadata and controls
29 lines (27 loc) · 806 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
<<<<<<< HEAD
#include <iostream>
=======
#include <iostream> //I know printf is less code and may be faster, but there has to be a difference between C and C++ code
>>>>>>> origin/master
#include <ctime>
using namespace std;
int main() {
<<<<<<< HEAD
const long milliSecond = (double)CLOCKS_PER_SEC / 1000.0;
=======
const double milliSecond = (double)CLOCKS_PER_SEC / 1000.0f;
>>>>>>> origin/master
clock_t lastTime;
int times = 0;
clock_t currentTime;
lastTime = clock();
while (1) {
if (clock() - lastTime < milliSecond) {
times++;
}else{
cout << times << "\r";
times = 0;
lastTime = clock();
}
}
}