Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to get current timestamp in milliseconds since 1970
#include <chrono>
// If you have access to the C++ 11 libraries, check out the std::chrono library.
// You can use it to get the milliseconds since the Unix Epoch like this:
using namespace std::chrono;
milliseconds ms = duration_cast< milliseconds >(
printf("\n\ntimestamp: %ld\n\n", ms);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment