-
Simon McVittie authored
If we call time(NULL), then do something (however trivial), then call g_date_time_new_now_utc(), they do not necessarily share a seconds value. Let's say the gmtime call takes 2ms. time(NULL) could return xx:xx:23 when the time is actually xx:xx:23.999999, resulting in the g_date_time_new_now_utc() happening at xx:xx:24.000001. This is unlikely, but did happen to me in a parallel build: GLib:ERROR:.../glib/tests/gdatetime.c:674:test_GDateTime_now_utc: assertion failed (tm.tm_sec == g_date_time_get_second (dt)): (23 == 24) A similar argument applies to the rollover from xx:23:59.999999 to xx:24:00, so comparing seconds with a 1s "fuzz" or a >= comparison is not sufficient; and so on into higher-order fields. I haven't seen the other tests that use _now() fail in the same way, but they could. Bug: https://bugzilla.gnome.org/show_bug.cgi?id=749080 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
472dee39