Add app_timer_user for Windows build

This commit is contained in:
kinichiro 2017-12-26 22:49:01 +09:00
parent 7b6953e9a9
commit 82ce59838e

View File

@ -13,7 +13,7 @@
#include "apps.h" #include "apps.h"
double double
app_tminterval(int stop, int usertime) app_timer_user(int stop)
{ {
static unsigned __int64 tmstart; static unsigned __int64 tmstart;
union { union {
@ -22,13 +22,11 @@ app_tminterval(int stop, int usertime)
} ct, et, kt, ut; } ct, et, kt, ut;
GetProcessTimes(GetCurrentProcess(), &ct.ft, &et.ft, &kt.ft, &ut.ft); GetProcessTimes(GetCurrentProcess(), &ct.ft, &et.ft, &kt.ft, &ut.ft);
if (stop)
if (stop == TM_START) {
tmstart = ut.u64 + kt.u64;
} else {
return (ut.u64 + kt.u64 - tmstart) / (double) 10000000; return (ut.u64 + kt.u64 - tmstart) / (double) 10000000;
}
return 0; tmstart = ut.u64 + kt.u64;
return 0.0;
} }
int int