Created
September 8, 2014 12:20
-
-
Save ksophocleous/f9c2eb8f13e188634fa8 to your computer and use it in GitHub Desktop.
cross platform unix timestamp in c++
This file contains hidden or 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 <iostream> | |
#include <chrono> | |
int main(int argc, char *argv[]) | |
{ | |
auto tp = std::chrono::system_clock::now(); | |
auto dur = tp.time_since_epoch(); | |
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(dur).count(); | |
std::cout << "Timestamp: " << seconds << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks.