• Chip Davis's avatar
    ntdll: Fix tick count calculation on Mac. · 289d456d
    Chip Davis authored
    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: 's avatarChip Davis <cdavis@codeweavers.com>
    Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com>
    Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
    289d456d
Name
Last commit
Last update
..
nls Loading commit data...
tests Loading commit data...
Makefile.in Loading commit data...
actctx.c Loading commit data...
atom.c Loading commit data...
comm.c Loading commit data...
computername.c Loading commit data...
console.c Loading commit data...
console_private.h Loading commit data...
cpu.c Loading commit data...
debugger.c Loading commit data...
editline.c Loading commit data...
environ.c Loading commit data...
file.c Loading commit data...
format_msg.c Loading commit data...
heap.c Loading commit data...
kernel32.spec Loading commit data...
kernel_main.c Loading commit data...
kernel_private.h Loading commit data...
lcformat.c Loading commit data...
locale.c Loading commit data...
locale_rc.rc Loading commit data...
lzexpand.c Loading commit data...
module.c Loading commit data...
nameprep.c Loading commit data...
path.c Loading commit data...
powermgnt.c Loading commit data...
process.c Loading commit data...
profile.c Loading commit data...
resource.c Loading commit data...
string.c Loading commit data...
sync.c Loading commit data...
tape.c Loading commit data...
term.c Loading commit data...
thread.c Loading commit data...
time.c Loading commit data...
toolhelp.c Loading commit data...
version.c Loading commit data...
version.rc Loading commit data...
virtual.c Loading commit data...
volume.c Loading commit data...
wctype.c Loading commit data...
wer.c Loading commit data...
winerror.mc Loading commit data...