Answers for "c++ time nanoseconds"

C++
1

c++ time nanoseconds

#include <iostream>
#include <chrono>

int main() {
    auto start = std::chrono::high_resolution_clock::now();
    // operation to be timed ...
    auto finish = std::chrono::high_resolution_clock::now();
    auto time_in_nanoseconds =  std::chrono::duration_cast<std::chrono::nanoseconds>(finish-start).count();
}
Posted by: Guest on May-06-2021

Browse Popular Code Answers by Language