This commit is contained in:
xinyang
2019-07-31 14:54:40 +08:00
parent 98bc5ef95b
commit 5212e0da73

26
others/src/systime.cpp Normal file
View File

@@ -0,0 +1,26 @@
//
// Created by xinyang on 19-7-31.
//
#include <systime.h>
#if defined(Linux)
void getsystime(systime &t){
timeval tv;
gettimeofday(&tv, nullptr);
t.second = tv.tv_sec;
t.millisecond = tv.tv_usec/1000;
}
#elif defined(Windows)
void getsystime(systime &t){
SYSTEMTIME tv;
GetLocalTime(&tv);
t.second = tv.wSecond;
t.millisecond = tv.wMilliseconds;
}
#else
#error "nonsupport platform."
#endif