Merge pull request #67 from darkredtitan/master

Fix social distancing bug (name trademarked by kamilprzyb)
This commit is contained in:
CPunch 2020-09-05 20:37:53 -05:00 committed by GitHub
commit e936cb9fac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,7 @@
#include "CNStructs.hpp"
#if defined _MSC_VER
#include <chrono>
#endif
std::string U16toU8(char16_t* src) {
try {
@ -27,8 +30,7 @@ uint64_t getTime() {
gettimeofday(&tp, NULL);
return tp.tv_sec * 1000 + tp.tv_usec / 1000;
#else
time_t t;
time(&t);
return (uint64_t)t;
std::chrono::milliseconds value = std::chrono::duration_cast<std::chrono::milliseconds>((std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now())).time_since_epoch());
return (uint64_t)(value.count());
#endif
}