Last active
December 15, 2017 05:25
-
-
Save laohyx/3db81c145f2b4ec1989172aee6429865 to your computer and use it in GitHub Desktop.
One liner for getting current microsecond of unix timestamp.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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