Skip to content

Instantly share code, notes, and snippets.

@syohex
Created April 24, 2020 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syohex/75bc2108241036cbbc07350975771de4 to your computer and use it in GitHub Desktop.
Save syohex/75bc2108241036cbbc07350975771de4 to your computer and use it in GitHub Desktop.
#include <chrono>
#include <iostream>
int main() {
struct timespec n;
for (int i = 0; i < 20; ++i) {
auto now = std::chrono::system_clock::now();
auto now_ns = std::chrono::time_point_cast<std::chrono::nanoseconds>(now);
std::cout << "current nano: " << now_ns.time_since_epoch().count() << std::endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment