mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-04 22:40:05 +00:00
MSVC support: alternative implementation of getTime()
This commit is contained in:
parent
1ec4634f69
commit
e75049fc98
@ -18,7 +18,13 @@ int U8toU16(std::string src, char16_t* des) {
|
||||
}
|
||||
|
||||
uint64_t getTime() {
|
||||
#ifndef _MSC_VER
|
||||
struct timeval tp;
|
||||
gettimeofday(&tp, NULL);
|
||||
return tp.tv_sec * 1000 + tp.tv_usec / 1000;
|
||||
#else
|
||||
time_t t;
|
||||
time(&t);
|
||||
return (uint64_t)t;
|
||||
#endif
|
||||
}
|
@ -10,7 +10,12 @@
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
// Can't use this in MSVC.
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <locale>
|
||||
|
Loading…
Reference in New Issue
Block a user