diff options
author | wtc%google.com <devnull@localhost> | 2008-11-21 21:14:50 +0000 |
---|---|---|
committer | wtc%google.com <devnull@localhost> | 2008-11-21 21:14:50 +0000 |
commit | 3c037d5f1a0408bb82504f2b29466109bfb769c2 (patch) | |
tree | b22e3a5af8560e992195f910ad10fa27c119413c | |
parent | e758dcaafb83505acea29e50e705dd710163b4ea (diff) | |
download | nspr-hg-3c037d5f1a0408bb82504f2b29466109bfb769c2.tar.gz |
Bug 463562: load mmtimer.dll and look up timeGetTime at run time because
not all WINCE systems have mmtimer.dll. The patch is contributed by Brad
Lassey <blassey@mozilla.com>. r=wtc.
-rw-r--r-- | pr/src/md/windows/ntinrval.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/pr/src/md/windows/ntinrval.c b/pr/src/md/windows/ntinrval.c index b8d85831..f96c27b5 100644 --- a/pr/src/md/windows/ntinrval.c +++ b/pr/src/md/windows/ntinrval.c @@ -42,15 +42,34 @@ #include "primpl.h" +#ifdef WINCE +typedef DWORD (*IntervalFuncType)(void); +static IntervalFuncType intervalFunc; +#endif + void _PR_MD_INTERVAL_INIT() { +#ifdef WINCE + HMODULE mmtimerlib = LoadLibraryW(L"mmtimer.dll"); /* XXX leaked! */ + if (mmtimerlib) { + intervalFunc = (IntervalFuncType)GetProcAddress(mmtimerlib, + "timeGetTime"); + } else { + intervalFunc = &GetTickCount; + } +#endif } PRIntervalTime _PR_MD_GET_INTERVAL() { - return timeGetTime(); /* milliseconds since system start */ + /* milliseconds since system start */ +#ifdef WINCE + return (*intervalFunc)(); +#else + return timeGetTime(); +#endif } PRIntervalTime |