Skip to content

Instantly share code, notes, and snippets.

@laohyx
Last active December 15, 2017 05:25
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 laohyx/3db81c145f2b4ec1989172aee6429865 to your computer and use it in GitHub Desktop.
Save laohyx/3db81c145f2b4ec1989172aee6429865 to your computer and use it in GitHub Desktop.
One liner for getting current microsecond of unix timestamp.
#include <chrono>
int64_t timeInMicroseconds() {
auto now = std::chrono::system_clock::now();
auto duration = now.time_since_epoch();
return std::chrono::duration_cast<std::chrono::microseconds>(duration).count();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment