mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-24 22:11:04 +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() {
|
uint64_t getTime() {
|
||||||
|
#ifndef _MSC_VER
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
gettimeofday(&tp, NULL);
|
gettimeofday(&tp, NULL);
|
||||||
return tp.tv_sec * 1000 + tp.tv_usec / 1000;
|
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 <iostream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
// Can't use this in MSVC.
|
||||||
|
#ifndef _MSC_VER
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#else
|
||||||
|
#include <time.h>
|
||||||
|
#endif
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
Loading…
Reference in New Issue
Block a user