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
atom.c
comm.c
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
editline.c
environ.c
file.c kernel32: Remove dead code. 2019-11-26 15:38:32 +01:00
format_msg.c
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
nameprep.c
path.c kernel32: Move GetSystemWow64Directory() functions to kernelbase. 2019-11-12 22:05:58 +01:00
powermgnt.c
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
string.c
sync.c
tape.c
term.c
thread.c
time.c ntdll: Fix tick count calculation on Mac. 2019-11-28 20:45:46 +01:00
toolhelp.c
version.c
version.rc
virtual.c
volume.c
wctype.c
wer.c
winerror.mc