Skip to content
Commit 419f5713 authored by Allison Karlitskaya's avatar Allison Karlitskaya
Browse files

GDateTime test: fix occasional failures

We were using the time() library call to get the current time from the
system in order to compare it to the time returned by
g_date_time_new_now().

Of course, we took care to ensure that the time (in seconds) didn't
change in the middle of this process by checking the before and after
value of the system time.

Unfortunately, the system time as measured by time() was being taken
from a less-accurate clock source than the time used by GDateTime.  As a
result, we could have GDateTime already into the next second while the
"seconds" value of the time returned by time() was still in the last
one, even when checked "after".

Avoid the problem by using the same ultimate source for time --
g_get_real_time().

This is based on a similar patch from Iain Lane, but it uses
g_get_real_time() instead of g_get_current_time().

https://bugzilla.gnome.org/show_bug.cgi?id=754994
parent 75eaf509
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment