ReactOS 0.4.17-dev-116-ga4b6fe9
time.c
Go to the documentation of this file.
1/*
2 * Unit test suite for ntdll time functions
3 *
4 * Copyright 2004 Rein Klazes
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <stdarg.h>
22
23#include "ntstatus.h"
24#define WIN32_NO_STATUS
25#include "windef.h"
26#include "winbase.h"
27#include "winternl.h"
28#include "ddk/wdm.h"
29#include "intrin.h"
30#include "wine/test.h"
31
32#define TICKSPERSEC 10000000
33#define TICKSPERMSEC 10000
34#define SECSPERDAY 86400
35
36static VOID (WINAPI *pRtlTimeToTimeFields)( const LARGE_INTEGER *liTime, PTIME_FIELDS TimeFields) ;
37static VOID (WINAPI *pRtlTimeFieldsToTime)( PTIME_FIELDS TimeFields, PLARGE_INTEGER Time) ;
38static NTSTATUS (WINAPI *pNtQueryPerformanceCounter)( LARGE_INTEGER *counter, LARGE_INTEGER *frequency );
39static NTSTATUS (WINAPI *pNtQuerySystemInformation)( SYSTEM_INFORMATION_CLASS class,
41static NTSTATUS (WINAPI *pRtlQueryTimeZoneInformation)( RTL_TIME_ZONE_INFORMATION *);
42static NTSTATUS (WINAPI *pRtlQueryDynamicTimeZoneInformation)( RTL_DYNAMIC_TIME_ZONE_INFORMATION *);
43static BOOL (WINAPI *pRtlQueryUnbiasedInterruptTime)( ULONGLONG *time );
44
45static BOOL (WINAPI *pRtlQueryPerformanceCounter)(LARGE_INTEGER*);
46static BOOL (WINAPI *pRtlQueryPerformanceFrequency)(LARGE_INTEGER*);
47
48static const int MonthLengths[2][12] =
49{
50 { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
51 { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
52};
53
54static inline BOOL IsLeapYear(int Year)
55{
56 return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0);
57}
58
59/* start time of the tests */
60static TIME_FIELDS tftest = {1889,12,31,23,59,59,0,0};
61
63{
64 LARGE_INTEGER litime , liresult;
65 TIME_FIELDS tfresult;
66 int i=0;
67 litime.QuadPart = ((ULONGLONG)0x0144017a << 32) | 0xf0b0a980;
68 while( tftest.Year < 2110 ) {
69 /* test at the last second of the month */
70 pRtlTimeToTimeFields( &litime, &tfresult);
71 ok( tfresult.Year == tftest.Year && tfresult.Month == tftest.Month &&
72 tfresult.Day == tftest.Day && tfresult.Hour == tftest.Hour &&
73 tfresult.Minute == tftest.Minute && tfresult.Second == tftest.Second,
74 "#%d expected: %d-%d-%d %d:%d:%d got: %d-%d-%d %d:%d:%d\n", ++i,
77 tfresult.Year, tfresult.Month, tfresult.Day,
78 tfresult.Hour, tfresult.Minute, tfresult.Second);
79 /* test the inverse */
80 pRtlTimeFieldsToTime( &tfresult, &liresult);
81 ok( liresult.QuadPart == litime.QuadPart," TimeFieldsToTime failed on %d-%d-%d %d:%d:%d. Error is %d ticks\n",
82 tfresult.Year, tfresult.Month, tfresult.Day,
83 tfresult.Hour, tfresult.Minute, tfresult.Second,
84 (int) (liresult.QuadPart - litime.QuadPart) );
85 /* one second later is beginning of next month */
86 litime.QuadPart += TICKSPERSEC ;
87 pRtlTimeToTimeFields( &litime, &tfresult);
88 ok( tfresult.Year == tftest.Year + (tftest.Month ==12) &&
89 tfresult.Month == tftest.Month % 12 + 1 &&
90 tfresult.Day == 1 && tfresult.Hour == 0 &&
91 tfresult.Minute == 0 && tfresult.Second == 0,
92 "#%d expected: %d-%d-%d %d:%d:%d got: %d-%d-%d %d:%d:%d\n", ++i,
93 tftest.Year + (tftest.Month ==12),
94 tftest.Month % 12 + 1, 1, 0, 0, 0,
95 tfresult.Year, tfresult.Month, tfresult.Day,
96 tfresult.Hour, tfresult.Minute, tfresult.Second);
97 /* test the inverse */
98 pRtlTimeFieldsToTime( &tfresult, &liresult);
99 ok( liresult.QuadPart == litime.QuadPart," TimeFieldsToTime failed on %d-%d-%d %d:%d:%d. Error is %d ticks\n",
100 tfresult.Year, tfresult.Month, tfresult.Day,
101 tfresult.Hour, tfresult.Minute, tfresult.Second,
102 (int) (liresult.QuadPart - litime.QuadPart) );
103 /* advance to the end of the month */
104 litime.QuadPart -= TICKSPERSEC ;
105 if( tftest.Month == 12) {
106 tftest.Month = 1;
107 tftest.Year += 1;
108 } else
109 tftest.Month += 1;
112 }
113}
114
116{
119
120 status = pNtQueryPerformanceCounter(NULL, NULL);
121 ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
122 status = pNtQueryPerformanceCounter(NULL, &frequency);
123 ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
124 status = pNtQueryPerformanceCounter(&counter, (void *)0xdeadbee0);
125 ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
126 status = pNtQueryPerformanceCounter((void *)0xdeadbee0, &frequency);
127 ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
128
129 status = pNtQueryPerformanceCounter(&counter, NULL);
130 ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08lx\n", status);
131 status = pNtQueryPerformanceCounter(&counter, &frequency);
132 ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08lx\n", status);
133}
134
135#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arm64ec__)
136
137struct hypervisor_shared_data
138{
140 UINT64 QpcMultiplier;
141 UINT64 QpcBias;
142};
143
144/* 128-bit multiply a by b and return the high 64 bits, same as __umulh */
145static UINT64 multiply_tsc(UINT64 a, UINT64 b)
146{
147 UINT64 ah = a >> 32, al = (UINT32)a, bh = b >> 32, bl = (UINT32)b, m;
148 m = (ah * bl) + (bh * al) + ((al * bl) >> 32);
149 return (ah * bh) + (m >> 32);
150}
151
152static void test_RtlQueryPerformanceCounter(void)
153{
154 struct hypervisor_shared_data *hsd;
155 KSHARED_USER_DATA *usd = (void *)0x7ffe0000;
158 UINT64 tsc0, tsc1;
159 ULONG len;
160 BOOL ret;
161
162 if (!pRtlQueryPerformanceCounter || !pRtlQueryPerformanceFrequency)
163 {
164 win_skip( "RtlQueryPerformanceCounter/Frequency not available, skipping tests\n" );
165 return;
166 }
167
169 {
170 todo_wine win_skip("QpcBypassEnabled is not set, skipping tests\n");
171 return;
172 }
173
175 {
177 "unexpected QpcBypassEnabled %x, expected 0x83\n", usd->QpcBypassEnabled );
178 ok( usd->QpcFrequency == 10000000, "unexpected QpcFrequency %I64d, expected 10000000\n", usd->QpcFrequency );
179 ok( !usd->QpcShift, "unexpected QpcShift %d, expected 0\n", usd->QpcShift );
180
181 hsd = NULL;
182 status = pNtQuerySystemInformation( SystemHypervisorSharedPageInformation, &hsd, sizeof(void *), &len );
183 ok( !status, "NtQuerySystemInformation returned %lx\n", status );
184 ok( len == sizeof(void *), "unexpected SystemHypervisorSharedPageInformation length %lu\n", len );
185 ok( !!hsd, "unexpected SystemHypervisorSharedPageInformation address %p\n", hsd );
186
187 tsc0 = __rdtsc();
188 ret = pRtlQueryPerformanceCounter( &counter );
189 tsc1 = __rdtsc();
190 ok( ret, "RtlQueryPerformanceCounter failed\n" );
191
192 tsc0 = multiply_tsc(tsc0, hsd->QpcMultiplier) + hsd->QpcBias + usd->QpcBias;
193 tsc1 = multiply_tsc(tsc1, hsd->QpcMultiplier) + hsd->QpcBias + usd->QpcBias;
194
195 ok( tsc0 <= counter.QuadPart, "rdtscp %I64d and RtlQueryPerformanceCounter %I64d are out of order\n", tsc0, counter.QuadPart );
196 ok( counter.QuadPart <= tsc1, "RtlQueryPerformanceCounter %I64d and rdtscp %I64d are out of order\n", counter.QuadPart, tsc1 );
197 }
198 else
199 {
200 ok( usd->QpcShift == 10, "unexpected QpcShift %d, expected 10\n", usd->QpcShift );
201
202 tsc0 = __rdtsc();
203 ret = pRtlQueryPerformanceCounter( &counter );
204 tsc1 = __rdtsc();
205 ok( ret, "RtlQueryPerformanceCounter failed\n" );
206
207 tsc0 += usd->QpcBias;
208 tsc0 >>= usd->QpcShift;
209 tsc1 += usd->QpcBias;
210 tsc1 >>= usd->QpcShift;
211
212 ok( tsc0 <= counter.QuadPart, "rdtscp %I64d and RtlQueryPerformanceCounter %I64d are out of order\n", tsc0, counter.QuadPart );
213 ok( counter.QuadPart <= tsc1, "RtlQueryPerformanceCounter %I64d and rdtscp %I64d are out of order\n", counter.QuadPart, tsc1 );
214 }
215
216 ret = pRtlQueryPerformanceFrequency( &frequency );
217 ok( ret, "RtlQueryPerformanceFrequency failed\n" );
219 "RtlQueryPerformanceFrequency returned %I64d, expected USD QpcFrequency %I64d\n",
221}
222#endif
223
224#define TIMER_LEEWAY 10
225#define CHECK_CURRENT_TIMER(expected) \
226 do { \
227 ok(status == STATUS_SUCCESS, "NtSetTimerResolution failed %lx\n", status); \
228 ok(cur2 == (expected) || broken(abs((int)((expected) - cur2)) <= TIMER_LEEWAY) || /* __REACTOS__ */ broken(GetNTVersion() < _WIN32_WINNT_WIN7), "expected new timer resolution %lu, got %lu\n", (expected), cur2); \
229 set = cur2; \
230 min2 = min + 20000; \
231 cur2 = min2 + 1; \
232 max2 = cur2 + 1; \
233 status = NtQueryTimerResolution(&min2, &max2, &cur2); \
234 ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed %lx\n", status); \
235 ok(min2 == min, "NtQueryTimerResolution() expected min=%lu, got %lu\n", min, min2); \
236 ok(max2 == max, "NtQueryTimerResolution() expected max=%lu, got %lu\n", max, max2); \
237 ok(cur2 == set, "NtQueryTimerResolution() expected timer resolution %lu, got %lu\n", set, cur2); \
238 } while (0)
239
240static void test_TimerResolution(void)
241{
242 ULONG min, max, cur, min2, max2, cur2, set;
244
246 ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(NULL,,) success\n");
247
249 ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(,NULL,) success\n");
250
252 ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(,,NULL) success\n");
253
254 min = 212121;
255 cur = min + 1;
256 max = cur + 1;
258 ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%lx)\n", status);
259 ok(min == 156250 /* 1/64s HPET */ || min == 156001 /* RTC */,
260 "unexpected minimum timer resolution %lu\n", min);
261 ok(0 < max, "invalid maximum timer resolution, should be 0 < %lu\n", max);
262 ok(max <= cur || broken(max - TIMER_LEEWAY <= cur), "invalid timer resolutions, should be %lu <= %lu\n", max, cur);
263 ok(cur <= min || broken(cur <= min + TIMER_LEEWAY), "invalid timer resolutions, should be %lu <= %lu\n", cur, min);
264
266 ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution(,,NULL) success\n");
267
268 /* Nothing happens if that pointer is not good */
270 ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution() failed %lx\n", status);
271
272 min2 = min + 10000;
273 cur2 = min2 + 1;
274 max2 = cur2 + 1;
275 status = NtQueryTimerResolution(&min2, &max2, &cur2);
276 ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%lx)\n", status);
277 ok(min2 == min, "NtQueryTimerResolution() expected min=%lu, got %lu\n", min, min2);
278 ok(max2 == max, "NtQueryTimerResolution() expected max=%lu, got %lu\n", max, max2);
279 ok(cur2 == cur, "NtQueryTimerResolution() expected timer resolution %lu, got %lu\n", cur, cur2);
280
281 /* 'fails' until the first valid timer resolution request */
282 cur2 = 7654321;
283 status = NtSetTimerResolution(0, FALSE, &cur2);
284 ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %lx\n", status);
285 /* and returns the current timer resolution */
286 ok(cur2 == cur, "expected requested timer resolution %lu, got %lu\n", cur, cur2);
287
288
289 cur2 = 7654321;
290 status = NtSetTimerResolution(max - 1, TRUE, &cur2);
292
293 /* Rescinds our timer resolution request */
294 cur2 = 7654321;
295 status = NtSetTimerResolution(0, FALSE, &cur2);
296 ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %lx\n", status);
297 /* -> the timer resolution was reset to its initial value */
298 ok(cur2 == cur, "expected requested timer resolution %lu, got %lu\n", min, cur2);
299
300 cur2 = 7654321;
301 status = NtSetTimerResolution(0, FALSE, &cur2);
302 ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %lx\n", status);
303 ok(cur2 == cur, "expected requested timer resolution %lu, got %lu\n", cur, cur2);
304
305 cur2 = 7654321;
306 status = NtSetTimerResolution(min + 1, TRUE, &cur2);
307 ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %lx\n", status);
308 /* This works because:
309 * - Either cur is the minimum (15.6 ms) resolution already, i.e. the
310 * closest valid value 'set' is rounded to.
311 * - Or some other application requested a higher timer resolution, cur,
312 * and any attempt to lower the resolution has no effect until that
313 * request is rescinded (hopefully after this test is done).
314 */
316
317 /* The requested resolution may (win7) or may not be rounded */
318 cur2 = 7654321;
319 set = max < cur ? cur - 1 : max;
321 ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %lx\n", status);
322 ok(cur2 <= set || broken(cur2 <= set + TIMER_LEEWAY), "expected new timer resolution %lu <= %lu\n", cur2, set);
323 trace("timer resolution: %lu(max) <= %lu(cur) <= %lu(prev) <= %lu(min)\n", max, cur2, cur, min);
324
325 cur2 = 7654321;
326 status = NtSetTimerResolution(cur + 1, TRUE, &cur2);
327 CHECK_CURRENT_TIMER(cur); /* see min + 1 test */
328
329 /* Cleanup by rescinding the last request */
330 cur2 = 7654321;
331 status = NtSetTimerResolution(0, FALSE, &cur2);
332 ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %lx\n", status);
333 ok(cur2 == cur, "expected requested timer resolution %lu, got %lu\n", set, cur2);
334}
335
337{
338 RTL_DYNAMIC_TIME_ZONE_INFORMATION tzinfo, tzinfo2;
340 ULONG len;
341
342 /* test RtlQueryTimeZoneInformation returns an indirect string,
343 e.g. @tzres.dll,-32 (Vista or later) */
344 if (!pRtlQueryTimeZoneInformation || !pRtlQueryDynamicTimeZoneInformation)
345 {
346 win_skip("Time zone name tests require Vista or later\n");
347 return;
348 }
349
350 memset(&tzinfo, 0xcc, sizeof(tzinfo));
351 status = pRtlQueryDynamicTimeZoneInformation(&tzinfo);
353 "RtlQueryDynamicTimeZoneInformation failed, got %08lx\n", status);
354 ok(tzinfo.StandardName[0] == '@' ||
355 broken(tzinfo.StandardName[0]), /* some win10 2004 */
356 "standard time zone name isn't an indirect string, got %s\n",
358 ok(tzinfo.DaylightName[0] == '@' ||
359 broken(tzinfo.DaylightName[0]), /* some win10 2004 */
360 "daylight time zone name isn't an indirect string, got %s\n",
362
363 memset(&tzinfo2, 0xcc, sizeof(tzinfo2));
364 status = pNtQuerySystemInformation( SystemDynamicTimeZoneInformation, &tzinfo2, sizeof(tzinfo2), &len );
365 ok( !status, "NtQuerySystemInformation failed %lx\n", status );
366 ok( len == sizeof(tzinfo2), "wrong len %lu\n", len );
367 ok( !memcmp( &tzinfo, &tzinfo2, sizeof(tzinfo2) ), "tz data is different\n" );
368
369 memset(&tzinfo, 0xcc, sizeof(tzinfo));
370 status = pRtlQueryTimeZoneInformation((RTL_TIME_ZONE_INFORMATION *)&tzinfo);
372 "RtlQueryTimeZoneInformation failed, got %08lx\n", status);
373 ok(tzinfo.StandardName[0] == '@' ||
374 broken(tzinfo.StandardName[0]), /* some win10 2004 */
375 "standard time zone name isn't an indirect string, got %s\n",
377 ok(tzinfo.DaylightName[0] == '@' ||
378 broken(tzinfo.DaylightName[0]), /* some win10 2004 */
379 "daylight time zone name isn't an indirect string, got %s\n",
381
382 memset(&tzinfo, 0xcc, sizeof(tzinfo));
383 status = pRtlQueryTimeZoneInformation((RTL_TIME_ZONE_INFORMATION *)&tzinfo);
385 "RtlQueryTimeZoneInformation failed, got %08lx\n", status);
386 ok(tzinfo.StandardName[0] == '@' ||
387 broken(tzinfo.StandardName[0]), /* some win10 2004 */
388 "standard time zone name isn't an indirect string, got %s\n",
390 ok(tzinfo.DaylightName[0] == '@' ||
391 broken(tzinfo.DaylightName[0]), /* some win10 2004 */
392 "daylight time zone name isn't an indirect string, got %s\n",
394
395 memset(&tzinfo2, 0xcc, sizeof(tzinfo2));
396 status = pNtQuerySystemInformation( SystemCurrentTimeZoneInformation, &tzinfo2,
397 sizeof(RTL_TIME_ZONE_INFORMATION), &len );
398 ok( !status, "NtQuerySystemInformation failed %lx\n", status );
399 ok( len == sizeof(RTL_TIME_ZONE_INFORMATION), "wrong len %lu\n", len );
400 ok( !memcmp( &tzinfo, &tzinfo2, sizeof(RTL_TIME_ZONE_INFORMATION) ), "tz data is different\n" );
401}
402
404{
405 ULONGLONG high, low;
406 do
407 {
408 high = time->High1Time;
409 low = time->LowPart;
410 }
411 while (high != time->High2Time);
412 return high << 32 | low;
413}
414
416{
417 KSHARED_USER_DATA *user_shared_data = (void *)0x7ffe0000;
419 ULONGLONG t1, t2, t3;
421 int i = 0;
422
423 i = 0;
424 do
425 {
426 t1 = GetTickCount();
427 if (user_shared_data->NtMajorVersion <= 5 && user_shared_data->NtMinorVersion <= 1)
428 t2 = (DWORD)((*(volatile ULONG*)&user_shared_data->TickCountLowDeprecated * (ULONG64)user_shared_data->TickCountMultiplier) >> 24);
429 else
430 t2 = (DWORD)((read_ksystem_time(&user_shared_data->TickCount) * user_shared_data->TickCountMultiplier) >> 24);
431 t3 = GetTickCount();
432 } while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
433
434 ok(t1 <= t2, "USD TickCount / GetTickCount are out of order: %s %s\n",
436 ok(t2 <= t3, "USD TickCount / GetTickCount are out of order: %s %s\n",
438
439 i = 0;
440 do
441 {
442 LARGE_INTEGER system_time;
443 NtQuerySystemTime(&system_time);
444 t1 = system_time.QuadPart;
445 t2 = read_ksystem_time(&user_shared_data->SystemTime);
446 NtQuerySystemTime(&system_time);
447 t3 = system_time.QuadPart;
448 } while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
449
450 /* FIXME: not always in order, but should be close */
451 todo_wine_if(t1 > t2 && t1 - t2 < 50 * TICKSPERMSEC)
452 ok(t1 <= t2, "USD SystemTime / NtQuerySystemTime are out of order %s %s\n",
454 ok(t2 <= t3, "USD SystemTime / NtQuerySystemTime are out of order %s %s\n",
456
457 if (!pRtlQueryUnbiasedInterruptTime)
458 win_skip("skipping RtlQueryUnbiasedInterruptTime tests\n");
459 else
460 {
461 i = 0;
462 do
463 {
464 pRtlQueryUnbiasedInterruptTime(&t1);
465 t2 = read_ksystem_time(&user_shared_data->InterruptTime) - user_shared_data->InterruptTimeBias;
466 pRtlQueryUnbiasedInterruptTime(&t3);
467 } while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
468
469 ok(t1 <= t2, "USD InterruptTime / RtlQueryUnbiasedInterruptTime are out of order %s %s\n",
471 ok(t2 <= t3, "USD InterruptTime / RtlQueryUnbiasedInterruptTime are out of order %s %s\n",
473 }
474
475 t1 = read_ksystem_time(&user_shared_data->TimeZoneBias);
476 status = NtQuerySystemInformation(SystemTimeOfDayInformation, &timeofday, sizeof(timeofday), NULL);
477 ok(!status, "failed to query time of day, status %#lx\n", status);
478 ok(timeofday.TimeZoneBias.QuadPart == t1, "got USD bias %I64u, ntdll bias %I64u\n",
479 t1, timeofday.TimeZoneBias.QuadPart);
480}
481
483{
484 HMODULE mod = GetModuleHandleA("ntdll.dll");
485 pRtlTimeToTimeFields = (void *)GetProcAddress(mod,"RtlTimeToTimeFields");
486 pRtlTimeFieldsToTime = (void *)GetProcAddress(mod,"RtlTimeFieldsToTime");
487 pNtQueryPerformanceCounter = (void *)GetProcAddress(mod, "NtQueryPerformanceCounter");
488 pNtQuerySystemInformation = (void *)GetProcAddress(mod, "NtQuerySystemInformation");
489 pRtlQueryTimeZoneInformation =
490 (void *)GetProcAddress(mod, "RtlQueryTimeZoneInformation");
491 pRtlQueryDynamicTimeZoneInformation =
492 (void *)GetProcAddress(mod, "RtlQueryDynamicTimeZoneInformation");
493 pRtlQueryUnbiasedInterruptTime = (void *)GetProcAddress(mod, "RtlQueryUnbiasedInterruptTime");
494 pRtlQueryPerformanceCounter = (void *)GetProcAddress(mod, "RtlQueryPerformanceCounter");
495 pRtlQueryPerformanceFrequency = (void *)GetProcAddress(mod, "RtlQueryPerformanceFrequency");
496
497 if (pRtlTimeToTimeFields && pRtlTimeFieldsToTime)
499 else
500 win_skip("Required time conversion functions are not available\n");
504#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arm64ec__)
505 test_RtlQueryPerformanceCounter();
506#endif
508}
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:68
#define VOID
Definition: acefi.h:82
COMPILER_DEPENDENT_UINT64 UINT64
Definition: actypes.h:131
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
LONG NTSTATUS
Definition: precomp.h:26
Definition: _set.h:50
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NTSTATUS
Definition: precomp.h:19
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define GetProcAddress(x, y)
Definition: compat.h:753
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static const struct _KUSER_SHARED_DATA * user_shared_data
Definition: sync.c:43
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
#define TICKSPERSEC
Definition: time.c:236
#define SECSPERDAY
Definition: time.c:233
static const int MonthLengths[2][12]
Definition: time.c:57
#define TICKSPERMSEC
Definition: time.c:237
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
@ SystemCurrentTimeZoneInformation
Definition: ntddk_ex.h:59
@ SystemTimeOfDayInformation
Definition: ntddk_ex.h:14
enum _SYSTEM_INFORMATION_CLASS SYSTEM_INFORMATION_CLASS
#define STATUS_ACCESS_VIOLATION
FxCollectionEntry * cur
GLsizeiptr size
Definition: glext.h:5919
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLsizei len
Definition: glext.h:6722
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
const GLfloat * m
Definition: glext.h:10848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PPC_QUAL unsigned long long __rdtsc(void)
Definition: intrin_ppc.h:688
#define b
Definition: ke_i.h:79
#define wine_dbgstr_w
Definition: kernel32.h:34
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
__u16 time
Definition: mkdosfs.c:8
unsigned __int64 ULONG64
Definition: imports.h:198
static void test_NtQueryPerformanceCounter(void)
Definition: time.c:115
static void test_user_shared_data_time(void)
Definition: time.c:415
static void test_pRtlTimeToTimeFields(void)
Definition: time.c:62
static PLARGE_INTEGER Time
Definition: time.c:37
static LARGE_INTEGER * frequency
Definition: time.c:38
static TIME_FIELDS tftest
Definition: time.c:60
static ULONGLONG read_ksystem_time(volatile KSYSTEM_TIME *time)
Definition: time.c:403
#define TIMER_LEEWAY
Definition: time.c:224
static void test_TimerResolution(void)
Definition: time.c:240
#define CHECK_CURRENT_TIMER(expected)
Definition: time.c:225
static void * info
Definition: time.c:40
static void ULONG ULONG * ret_size
Definition: time.c:40
static PTIME_FIELDS TimeFields
Definition: time.c:36
static void test_RtlQueryTimeZoneInformation(void)
Definition: time.c:336
#define min(a, b)
Definition: monoChain.cc:55
@ SystemHypervisorSharedPageInformation
Definition: extypes.h:430
@ SystemDynamicTimeZoneInformation
Definition: extypes.h:321
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
NTSTATUS NTAPI NtQueryTimerResolution(OUT PULONG MinimumResolution, OUT PULONG MaximumResolution, OUT PULONG ActualResolution)
Definition: time.c:627
NTSTATUS NTAPI NtSetTimerResolution(IN ULONG DesiredResolution, IN BOOLEAN SetResolution, OUT PULONG CurrentResolution)
Definition: time.c:678
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition: time.c:563
#define STATUS_TIMER_RESOLUTION_NOT_SET
Definition: ntstatus.h:835
#define memset(x, y, z)
Definition: compat.h:39
#define STATUS_SUCCESS
Definition: shellext.h:65
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
LONGLONG QpcFrequency
Definition: wdm.h:86
UCHAR QpcShift
Definition: wdm.h:127
volatile ULONGLONG QpcBias
Definition: wdm.h:120
UCHAR volatile QpcBypassEnabled
Definition: wdm.h:126
LARGE_INTEGER TimeZoneBias
Definition: extypes.h:1034
Definition: ps.c:97
#define max(a, b)
Definition: svc.c:63
int64_t LONGLONG
Definition: typedefs.h:68
uint64_t ULONGLONG
Definition: typedefs.h:67
uint32_t UINT32
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
#define IsLeapYear(y)
Definition: variant.c:1048
#define SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_RDTSCP
Definition: wdm.h:141
#define SHARED_GLOBAL_FLAGS_QPC_BYPASS_ENABLED
Definition: wdm.h:135
#define SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_HV_PAGE
Definition: wdm.h:136
#define WINAPI
Definition: msvc.h:6