gmain: rework g_get_monotonic_time() a bit
authorRyan Lortie <desrt@desrt.ca>
Tue, 18 Feb 2014 19:09:49 +0000 (14:09 -0500)
committerRyan Lortie <desrt@desrt.ca>
Thu, 20 Feb 2014 22:52:49 +0000 (17:52 -0500)
commitd61431254636b9ecc250884eb34757c2504e5685
treef9249d628c761e8c1a61b18fa5cf13e0db8d45ab
parent20f4d1820b8d4d0fc4447188e33efffd6d4a88d8
gmain: rework g_get_monotonic_time() a bit

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
configure.ac
glib/gmain.c