Add gethitickms() to the Windows layer.

git-svn-id: https://svn.eduke32.com/eduke32@2848 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-07-25 18:56:15 +00:00
parent 25e25b71fd
commit 568f213de8
2 changed files with 12 additions and 1 deletions

View file

@ -878,7 +878,6 @@ uint64_t gethitickspersec(void)
#endif
}
// TODO: winlayer too
// Returns the time since an unspecified starting time in milliseconds.
// (May be not monotonic for certain configurations.)
ATTRIBUTE((flatten))

View file

@ -1558,6 +1558,7 @@ static const char *GetDInputError(HRESULT code)
static int64_t timerfreq=0;
static int32_t timerlastsample=0;
int32_t timerticspersec=0;
static double hiticksperms = 1e308;
static void (*usertimercallback)(void) = NULL;
// This timer stuff is all Ken's idea.
@ -1602,6 +1603,8 @@ int32_t inittimer(int32_t tickspersecond)
usertimercallback = NULL;
hiticksperms = (double)gethitickspersec() / 1000;
return 0;
}
@ -1614,6 +1617,8 @@ void uninittimer(void)
timerfreq=0;
timerticspersec = 0;
hiticksperms = 1e308;
}
//
@ -1663,6 +1668,13 @@ uint64_t gethitickspersec(void)
return timerfreq;
}
// Returns the time since an unspecified starting time in milliseconds.
ATTRIBUTE((flatten))
double gethitickms(void)
{
return (double)gethiticks() / hiticksperms;
}
//
// gettimerfreq() -- returns the number of ticks per second the timer is configured to generate
//