-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathe3-time.cpp
More file actions
30 lines (20 loc) · 780 Bytes
/
Copy pathe3-time.cpp
File metadata and controls
30 lines (20 loc) · 780 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
#include <sls/Detector.h>
#include <chrono>
#include <iostream>
int main(){
sls::Detector det;
//Set exposure time to 500us
std::chrono::microseconds t0{500};
det.setExptime(t0);
std::cout << "exptime: " << det.getExptime() << '\n';
//Set exposure time in floating point (232.57ms)
std::chrono::duration<double, std::milli> t1{232.57};
det.setExptime(std::chrono::duration_cast<std::chrono::nanoseconds>(t1));
std::cout << "exptime: " << det.getExptime() << '\n';
//Getting exposure time as an int in ns
auto r = det.getExptime();
auto t2 = r.squash();
int t_ns = t2.count();
std::cout << "Exptime in ns: " << t_ns << '\n';
std::cout << "Exptime in s: " << std::chrono::duration<double>(t2).count() << '\n';
}