#include <chrono>
#include <thread>
#include <iostream>
int main()
{
auto then = std::chrono::system_clock::now();
std::this_thread::sleep_for(std::chrono::seconds(1));
auto now = std::chrono::system_clock::now();
auto dur = now - then;
typedef std::chrono::duration<float> float_seconds;
auto secs = std::chrono::duration_cast<float_seconds>(dur);
std::cout << secs.count() << '\n';
}
#include <chrono>
#include <iostream>
int main(){
auto start = std::chrono::high_resolution_clock::now();
// Code to time here...
auto end = std::chrono::high_resolution_clock::now();
auto dur = end - start;
auto i_millis = std::chrono::duration_cast<std::chrono::milliseconds>(dur);
auto f_secs = std::chrono::duration_cast<std::chrono::duration<float>>(dur);
std::cout << i_millis.count() << '\n';
std::cout << f_secs.count() << '\n';
}