tests: Change the time function used in the bookmark tests
The current comparison has been seen to fail on vs2017-x86 (https://gitlab.gnome.org/pwithnall/glib/-/jobs/2643197):
not ok /bookmarks/deprecated - GLib:ERROR:../glib/tests/bookmarkfile.c:921:test_deprecated: assertion failed (t >= now): (1678122080 >= 1678122081)
I guess this is caused by a mismatch between the system clock as used by
time (NULL)
and g_get_real_time ()
(which is ultimately what
g_bookmark_file_set_added()
uses) on Windows.
Attempt to fix that by using g_get_real_time()
in the test harness
too, so the clock being used is consistent.
If that doesn’t work, my next guess is that some of the code in
test_deprecated()
is being reordered by the compiler. But that
shouldn’t happen, because the time()
call has side-effects, and
g_bookmark_file_set_added()
has side-effects, so they shouldn’t be
reordered with respect to each other. And certainly not so that the
latter one (in code order) ends up being called 1s after the other.
Signed-off-by: Philip Withnall pwithnall@endlessos.org