• 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
..
tests Loading commit data...
Makefile.in Loading commit data...
actctx.c Loading commit data...
atom.c Loading commit data...
cdrom.c Loading commit data...
critsection.c Loading commit data...
crypt.c Loading commit data...
debugbuffer.c Loading commit data...
debugtools.c Loading commit data...
directory.c Loading commit data...
env.c Loading commit data...
error.c Loading commit data...
exception.c Loading commit data...
file.c Loading commit data...
handletable.c Loading commit data...
heap.c Loading commit data...
large_int.c Loading commit data...
loader.c Loading commit data...
loadorder.c Loading commit data...
locale.c Loading commit data...
misc.c Loading commit data...
nt.c Loading commit data...
ntdll.spec Loading commit data...
ntdll_misc.h Loading commit data...
om.c Loading commit data...
path.c Loading commit data...
printf.c Loading commit data...
process.c Loading commit data...
reg.c Loading commit data...
relay.c Loading commit data...
resource.c Loading commit data...
rtl.c Loading commit data...
rtlbitmap.c Loading commit data...
rtlstr.c Loading commit data...
sec.c Loading commit data...
serial.c Loading commit data...
server.c Loading commit data...
signal_arm.c Loading commit data...
signal_arm64.c Loading commit data...
signal_i386.c Loading commit data...
signal_powerpc.c Loading commit data...
signal_x86_64.c Loading commit data...
string.c Loading commit data...
sync.c Loading commit data...
tape.c Loading commit data...
thread.c Loading commit data...
threadpool.c Loading commit data...
time.c Loading commit data...
version.c Loading commit data...
version.rc Loading commit data...
virtual.c Loading commit data...
wcstring.c Loading commit data...