andre@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public
andre@0:  * License, v. 2.0. If a copy of the MPL was not distributed with this
andre@0:  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
andre@0: 
andre@0: /*
andre@0:  * NT interval timers
andre@0:  *
andre@0:  */
andre@0: 
andre@0: #include "primpl.h"
andre@0: 
andre@0: #ifdef WINCE
andre@0: typedef DWORD (*IntervalFuncType)(void);
andre@0: static IntervalFuncType intervalFunc;
andre@0: #endif
andre@0: 
andre@0: void
andre@0: _PR_MD_INTERVAL_INIT()
andre@0: {
andre@0: #ifdef WINCE
andre@0:     HMODULE mmtimerlib = LoadLibraryW(L"mmtimer.dll");  /* XXX leaked! */
andre@0:     if (mmtimerlib) {
andre@0:         intervalFunc = (IntervalFuncType)GetProcAddress(mmtimerlib,
andre@0:                                                         "timeGetTime");
andre@0:     } else {
andre@0:         intervalFunc = &GetTickCount;
andre@0:     }
andre@0: #endif
andre@0: }
andre@0: 
andre@0: PRIntervalTime 
andre@0: _PR_MD_GET_INTERVAL()
andre@0: {
andre@0:     /* milliseconds since system start */
andre@0: #ifdef WINCE
andre@0:     return (*intervalFunc)();
andre@0: #else
andre@0:     return timeGetTime();
andre@0: #endif
andre@0: }
andre@0: 
andre@0: PRIntervalTime 
andre@0: _PR_MD_INTERVAL_PER_SEC()
andre@0: {
andre@0:     return 1000;
andre@0: }