[glib] GDateTime test: fix a race



commit 19e7026fe728678c33e4cf38290ea88f0941d648
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Sep 21 20:19:32 2011 -0400

    GDateTime test: fix a race
    
    We have a GDateTime test that compares the time now (as per the libc) to
    the time now (as per GDateTime).  The problem is that the time could
    change between those two "now"s.

 glib/tests/gdatetime.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 070ccff..9cfc2f1 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -724,7 +724,7 @@ test_GDateTime_to_utc (void)
     memcpy (&tm, tmp, sizeof (struct tm));
   }
 #endif
-  dt2 = g_date_time_new_now_local ();
+  dt2 = g_date_time_new_from_unix_local (t);
   dt = g_date_time_to_utc (dt2);
   g_assert_cmpint (tm.tm_year + 1900, ==, g_date_time_get_year (dt));
   g_assert_cmpint (tm.tm_mon + 1, ==, g_date_time_get_month (dt));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]