[Project64] Use clock_gettime in CDateTime::SetToNow for android

This commit is contained in:
zilmar 2016-06-07 17:29:24 +10:00
parent b6068d81d4
commit 347062d745
1 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,10 @@
#include "stdafx.h"
#include "DateTimeClass.h"
#ifdef ANDROID
#include <math.h>
#else
#include <sys/timeb.h>
#endif
#include <time.h>
CDateTime::CDateTime()
@ -10,9 +14,15 @@ CDateTime::CDateTime()
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;
(void)::ftime(&now);
m_time = (now.time * 1000l) + now.millitm;
#endif
return *this;
}