Last active
May 29, 2019 03:43
-
-
Save sailfish009/c4b5ff2b6561ec2fb43748f03d1f28e9 to your computer and use it in GitHub Desktop.
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
#ifdef _WIN32 | |
#include <chrono> | |
uint64_t milliseconds(void) | |
{ | |
return std::chrono::duration_cast<std::chrono::milliseconds> | |
(std::chrono::steady_clock::now().time_since_epoch()).count(); | |
} | |
#else | |
#include <sys/time.h> | |
uint64_t milliseconds(void) | |
{ | |
struct timeval tv; | |
gettimeofday(&tv, NULL); | |
return (((uint64_t)tv.tv_sec * 1000) + ((uint64_t)tv.tv_usec / 1000)); | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment