Skip to content
  • Allison Karlitskaya's avatar
    gmain: rework g_get_monotonic_time() a bit · d6143125
    Allison Karlitskaya authored
    We now assume the existence of clock_gettime() and CLOCK_MONOTONIC as
    specified by POSIX.1-2001.  This means that we always return truly
    monotonic time, which will prevent problems in the case that the user
    changes the time.
    
    Mac OS doesn't have clock_gettime() but it does have
    mach_absolute_time(), so we can use that there.
    
    We keep our Windows case as well (although we should simplify it once XP
    hits EOL later this year).
    
    This patch removes the fallback to gettimeofday() in case of missing
    clock_gettime().  We no longer have any way to test this codepath and
    therefore it must go.
    
    This patch also restructures the #ifdef a bit so that we repeat the
    entire function definition inside of #ifdef instead of just the entire
    body of one function.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724687
    d6143125