ReactOS
0.4.16-dev-197-g92996da
time.c
Go to the documentation of this file.
1
/*
2
ReactOS Sound System
3
Timing helper
4
5
Author:
6
Andrew Greenwood (silverblade@reactos.org)
7
8
History:
9
31 May 2008 - Created
10
11
Notes:
12
Have checked timing in DebugView. A 10,000ms delay covered a period
13
of 124.305 sec to 134.308 sec. Not 100% accurate but likely down to
14
the delays in submitting the debug strings?
15
*/
16
17
/*
18
Nanoseconds are fun! You must try some!
19
1 ns = .000000001 seconds = .0000001 ms
20
100 ns = .0000001 seconds = .00001 ms
21
10000 ns = .00001 seconds = .001 ms
22
1000000 ns = .001 seconds = 1 ms
23
*/
24
25
#include <ntddk.h>
26
27
VOID
28
SleepMs
(
ULONG
Milliseconds)
29
{
30
LARGE_INTEGER
Period
;
31
32
Period
.
QuadPart
= Milliseconds;
33
Period
.
QuadPart
*= -10000;
34
35
KeDelayExecutionThread
(
KernelMode
,
FALSE
, &
Period
);
36
}
37
38
ULONG
39
QuerySystemTimeMs
()
40
{
41
LARGE_INTEGER
Time
;
42
43
KeQuerySystemTime
(&
Time
);
44
45
Time
.
QuadPart
/= 10000;
46
47
return
(
ULONG
)
Time
.
QuadPart
;
48
}
49
FALSE
#define FALSE
Definition:
types.h:117
KeQuerySystemTime
#define KeQuerySystemTime(t)
Definition:
env_spec_w32.h:570
KeDelayExecutionThread
#define KeDelayExecutionThread(mode, foo, t)
Definition:
env_spec_w32.h:484
void
Definition:
nsiface.idl:2307
Time
static PLARGE_INTEGER Time
Definition:
time.c:105
KernelMode
#define KernelMode
Definition:
asm.h:34
SleepMs
VOID SleepMs(ULONG Milliseconds)
Definition:
time.c:28
QuerySystemTimeMs
ULONG QuerySystemTimeMs()
Definition:
time.c:39
ULONG
uint32_t ULONG
Definition:
typedefs.h:59
_LARGE_INTEGER
Definition:
typedefs.h:103
_LARGE_INTEGER::QuadPart
LONGLONG QuadPart
Definition:
typedefs.h:114
Period
_In_ LARGE_INTEGER _In_ ULONG Period
Definition:
kefuncs.h:1313
sdk
lib
drivers
sound
shared
time.c
Generated on Wed Oct 30 2024 06:13:09 for ReactOS by
1.9.6