[glib] glib/tests/gdatetime: use UTC time in test_GDateTime_diff()
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] glib/tests/gdatetime: use UTC time in test_GDateTime_diff()
- Date: Sat, 17 Aug 2013 14:25:46 +0000 (UTC)
commit 5415537edb383fedfc5d4edc17dcf2bd2b8a38af
Author: Dan Winship <danw gnome org>
Date: Sun Jun 2 19:59:09 2013 -0300
glib/tests/gdatetime: use UTC time in test_GDateTime_diff()
test_GDateTime_diff() checks that the span from 2009-01-01 to
2010-01-01 is exactly 365 * G_TIME_SPAN_DAY, but it does this using
local time, and so fails if you are in a timezone that is in the
southern hemisphere which only did DST during one of 2008-2009 and
2009-2010 (in which case the year will end up being one hour too long
or too short).
Switch the diff tests to use UTC time instead; there are plenty of
other local time tests already.
https://bugzilla.gnome.org/show_bug.cgi?id=701529
glib/tests/gdatetime.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 4f82929..3bb5ebb 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -550,8 +550,8 @@ test_GDateTime_diff (void)
#define TEST_DIFF(y,m,d,y2,m2,d2,u) G_STMT_START { \
GDateTime *dt1, *dt2; \
GTimeSpan ts = 0; \
- dt1 = g_date_time_new_local (y, m, d, 0, 0, 0); \
- dt2 = g_date_time_new_local (y2, m2, d2, 0, 0, 0); \
+ dt1 = g_date_time_new_utc (y, m, d, 0, 0, 0); \
+ dt2 = g_date_time_new_utc (y2, m2, d2, 0, 0, 0); \
ts = g_date_time_difference (dt2, dt1); \
g_assert_cmpint (ts, ==, u); \
g_date_time_unref (dt1); \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]