Sweden-Number/dlls/kernel32
Chip Davis 289d456dd6 ntdll: Fix tick count calculation on Mac.
Inspired by a patch by Andrew Eikum.

macOS's mach_absolute_time() stops counting when the computer goes to
sleep/suspend/hibernate/etc. However, Windows's GetTickCount() does not
stop counting. mach_continuous_time() matches Windows's behavior.

BSD's CLOCK_MONOTONIC already counts asleep time.

Unfortunately, there is no clock source on Linux which does exactly what
we want. CLOCK_MONOTONIC_RAW is unaffected by NTP adjustment, but like
mach_absolute_time() doesn't keep ticking when the computer is asleep.
CLOCK_BOOTTIME does keep ticking, but it is affected by NTP adjustments.
CLOCK_MONOTONIC has both problems. What's needed is a
CLOCK_BOOTTIME_RAW, which would not be slewed by adjtimex(2) and would
count time spent asleep.

To avoid issues with skew and performance, this patch falls back to
mach_absolute_time() on macOS if mach_continuous_time() is unavailable.
Note that mach_continuous_time() was introduced in macOS 10.12, meaning
that if the minimum version required is less than that, it will be
linked weakly. Therefore we must check that it is nonnull before
attempting to call it.

Signed-off-by: Chip Davis <cdavis@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-28 20:45:46 +01:00
..
nls kernel32/nls: Add LOCALE_IGEOID to all locales. 2019-11-18 22:15:20 +01:00
tests kernel32: Reimplement FoldStringW() to support composition. 2019-11-28 09:04:33 +01:00
Makefile.in mountmgr: Populate HKLM\HARDWARE\DEVICEMAP\Scsi here instead of in kernel32. 2019-11-25 21:56:23 +01:00
actctx.c kernel32: Move activation context functions to kernelbase. 2019-07-02 16:28:17 +02:00
atom.c kernel32: Add set_ntstatus() helper. 2019-10-01 09:43:27 +02:00
comm.c kernel32: Move ioctl functions to kernelbase. 2019-09-09 21:05:07 +02:00
computername.c
console.c kernel32: Implement GetCurrentConsoleFontEx. 2019-11-25 20:47:43 +01:00
console_private.h
cpu.c kernel32: Move system information functions to kernelbase. 2019-11-19 23:15:04 +01:00
debugger.c kernel32: Move debugger functions to kernelbase. 2019-09-09 11:44:29 +02:00
editline.c
environ.c kernel32: Move process startup information functions to kernelbase. 2019-09-09 16:25:55 +02:00
file.c kernel32: Remove dead code. 2019-11-26 15:38:32 +01:00
format_msg.c kernel32: Add set_ntstatus() helper. 2019-10-01 09:43:27 +02:00
heap.c kernel32: Move physical memory status functions to kernelbase. 2019-11-19 23:15:04 +01:00
kernel32.spec kernel32: Move FoldStringW() function to kernelbase. 2019-11-28 09:05:13 +01:00
kernel_main.c kernel32: Move the locale registry setup to kernelbase. 2019-11-20 23:03:21 +01:00
kernel_private.h kernel32: Move the locale registry setup to kernelbase. 2019-11-20 23:03:21 +01:00
lcformat.c kernel32: Move EnumCalendarInfo functions to kernelbase. 2019-11-18 19:12:13 +01:00
locale.c kernel32: Move FoldStringW() function to kernelbase. 2019-11-28 09:05:13 +01:00
locale_rc.rc
lzexpand.c
module.c kernel32: Add a special case to EnumProcessModules for the local process. 2019-11-04 22:43:01 +01:00
nameprep.c
path.c kernel32: Move GetSystemWow64Directory() functions to kernelbase. 2019-11-12 22:05:58 +01:00
powermgnt.c kernel32: Implement GetSystemPowerStatus on top of NtPowerInformation. 2019-10-31 19:38:49 +01:00
process.c mountmgr: Populate HKLM\HARDWARE\DEVICEMAP\Scsi here instead of in kernel32. 2019-11-25 21:56:23 +01:00
profile.c
resource.c kernel32: Move resource functions to kernelbase. 2019-07-02 16:28:17 +02:00
string.c kernel32: Move lstr* string functions to kernelbase. 2019-07-01 15:56:46 +02:00
sync.c kernel32: Move some misc functions to kernelbase. 2019-09-26 19:36:10 +02:00
tape.c
term.c
thread.c kernel32: Move some process functions to kernelbase. 2019-08-09 15:24:52 +02:00
time.c ntdll: Fix tick count calculation on Mac. 2019-11-28 20:45:46 +01:00
toolhelp.c
version.c kernel32: Move some misc functions to kernelbase. 2019-09-26 19:36:10 +02:00
version.rc
virtual.c kernel32: Move virtual memory functions to kernelbase. 2019-09-08 22:52:09 +02:00
volume.c kernel32: Output a message in GetVolumeInformationW() when device has no read access. 2019-11-07 20:18:46 +01:00
wctype.c
wer.c
winerror.mc