Debian Codegraph @

nsprpub/pr/src/md/windows/ntinrval.c

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7 * NT interval timers
8 *
9 */
10
11 /* Mozilla's build system defines this globally. */
12 #ifdef WIN32_LEAN_AND_MEAN
13 # undef WIN32_LEAN_AND_MEAN
14 #endif
15 #include "primpl.h"
16
17 #ifdef WINCE
18 typedef DWORD (*IntervalFuncType)(void);
19 static IntervalFuncType intervalFunc;
20 #endif
21
22 void _PR_MD_INTERVAL_INIT() {
23 #ifdef WINCE
24 HMODULE mmtimerlib = LoadLibraryW(L"mmtimer.dll"); /* XXX leaked! */
25 if (mmtimerlib) {
26 intervalFunc = (IntervalFuncType)GetProcAddress(mmtimerlib, "timeGetTime");
27 } else {
28 intervalFunc = &GetTickCount;
29 }
30 #endif
31 }
32
33 PRIntervalTime _PR_MD_GET_INTERVAL() {
34 /* milliseconds since system start */
35 #ifdef WINCE
36 return (*intervalFunc)();
37 #else
38 return timeGetTime();
39 #endif
40 }
41
42 PRIntervalTime _PR_MD_INTERVAL_PER_SEC() { return 1000; }