forked from labstreaminglayer/App-LabRecorder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfptest.cpp
More file actions
20 lines (19 loc) · 667 Bytes
/
fptest.cpp
File metadata and controls
20 lines (19 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
int main() {
const double sampling_rate = 500, sample_interval = 1.0 / sampling_rate,
first_timestamp = 60 * 60 * 24 * 365 * 48; // e.g. a unix timestamp
double last_timestamp = first_timestamp;
int full = 0, deduced = 0;
const int iterations = 100000;
double timestamps[iterations];
for (int i = 0; i < iterations; ++i) timestamps[i] = first_timestamp + i / sampling_rate;
for (int i = 0; i < iterations; ++i) {
if (last_timestamp + sample_interval == timestamps[i])
deduced++;
else
full++;
last_timestamp = timestamps[i];
}
std::cout << "Deduced: " << deduced << "\nFully written: " << full << std::endl;
return 0;
}