[Project64] Use clock_gettime in CDateTime::SetToNow for android
This commit is contained in:
parent
b6068d81d4
commit
347062d745
|
@ -1,6 +1,10 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DateTimeClass.h"
|
#include "DateTimeClass.h"
|
||||||
|
#ifdef ANDROID
|
||||||
|
#include <math.h>
|
||||||
|
#else
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
|
#endif
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
CDateTime::CDateTime()
|
CDateTime::CDateTime()
|
||||||
|
@ -10,9 +14,15 @@ CDateTime::CDateTime()
|
||||||
|
|
||||||
CDateTime & CDateTime::SetToNow(void)
|
CDateTime & CDateTime::SetToNow(void)
|
||||||
{
|
{
|
||||||
|
#ifdef ANDROID
|
||||||
|
struct timespec now;
|
||||||
|
clock_gettime(CLOCK_REALTIME, &now);
|
||||||
|
m_time = (now.tv_sec * 1000l) + round(now.tv_nsec / 1.0e6);
|
||||||
|
#else
|
||||||
struct timeb now;
|
struct timeb now;
|
||||||
(void)::ftime(&now);
|
(void)::ftime(&now);
|
||||||
m_time = (now.time * 1000l) + now.millitm;
|
m_time = (now.time * 1000l) + now.millitm;
|
||||||
|
#endif
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue