mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 00:59:48 +00:00
75215fbce6
Backport 3 patches [1][2][3] for gdatetime test to fix the ptest failure. [1] https://github.com/GNOME/glib/commit/c0619f08e6c608fd6464d2f0c6970ef0bbfb9ecf [2] https://github.com/GNOME/glib/commit/30e9cfa5733003cd1079e0e9e8a4bff1a191171a [3] https://github.com/GNOME/glib/commit/fe2699369f79981dcf913af4cfd98b342b84a9c1 (From OE-Core rev: aaeac4978111fa4051296cb800251432dc02226a) Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 0c8f87d5d4ec9f286b1e85d114cb9a728c1ff64b) Signed-off-by: Steve Sakoman <steve@sakoman.com>
66 lines
2.7 KiB
Diff
66 lines
2.7 KiB
Diff
From 2702d7ff73649c05297105bab8977e2a9d28fa0b Mon Sep 17 00:00:00 2001
|
|
From: Simon McVittie <smcv@debian.org>
|
|
Date: Fri, 18 Oct 2024 11:03:19 +0100
|
|
Subject: [PATCH 2/3] gdatetime test: Try to make PST8PDT test more obviously
|
|
correct
|
|
|
|
Instead of using timestamp 0 as a magic number (in this case interpreted
|
|
as 1970-01-01T00:00:00-08:00), calculate a timestamp from a recent
|
|
year/month/day in winter, in this case 2024-01-01T00:00:00-08:00.
|
|
|
|
Similarly, instead of using a timestamp 15 million seconds later
|
|
(1970-06-23T15:40:00-07:00), calculate a timestamp from a recent
|
|
year/month/day in summer, in this case 2024-07-01T00:00:00-07:00.
|
|
|
|
Signed-off-by: Simon McVittie <smcv@debian.org>
|
|
|
|
Upstream-Status: Backport
|
|
[https://github.com/GNOME/glib/commit/30e9cfa5733003cd1079e0e9e8a4bff1a191171a]
|
|
|
|
Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
|
|
---
|
|
glib/tests/gdatetime.c | 15 +++++++--------
|
|
1 file changed, 7 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
|
|
index 2eefc4106..728b87343 100644
|
|
--- a/glib/tests/gdatetime.c
|
|
+++ b/glib/tests/gdatetime.c
|
|
@@ -2954,19 +2954,16 @@ test_posix_parse (void)
|
|
|
|
/* This fails rules_from_identifier on Unix (though not on Windows)
|
|
* but passes anyway because PST8PDT is a zone name.
|
|
- *
|
|
- * Intervals i1 and i2 (rather than 0 and 1) are needed because in
|
|
- * recent tzdata, PST8PDT may be an alias for America/Los_Angeles,
|
|
- * and hence be aware that DST has not always existed.
|
|
- * https://bugs.debian.org/1084190
|
|
*/
|
|
tz = g_time_zone_new_identifier ("PST8PDT");
|
|
g_assert_nonnull (tz);
|
|
g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "PST8PDT");
|
|
/* a date in winter = non-DST */
|
|
- i1 = g_time_zone_find_interval (tz, G_TIME_TYPE_STANDARD, 0);
|
|
- /* approximately 6 months in seconds, i.e. a date in summer = DST */
|
|
- i2 = g_time_zone_find_interval (tz, G_TIME_TYPE_DAYLIGHT, 15000000);
|
|
+ gdt1 = g_date_time_new (tz, 2024, 1, 1, 0, 0, 0);
|
|
+ i1 = g_time_zone_find_interval (tz, G_TIME_TYPE_STANDARD, g_date_time_to_unix (gdt1));
|
|
+ /* a date in summer = DST */
|
|
+ gdt2 = g_date_time_new (tz, 2024, 7, 1, 0, 0, 0);
|
|
+ i2 = g_time_zone_find_interval (tz, G_TIME_TYPE_DAYLIGHT, g_date_time_to_unix (gdt2));
|
|
g_assert_cmpstr (g_time_zone_get_abbreviation (tz, i1), ==, "PST");
|
|
g_assert_cmpint (g_time_zone_get_offset (tz, i1), ==, - 8 * 3600);
|
|
g_assert (!g_time_zone_is_dst (tz, i1));
|
|
@@ -2974,6 +2971,8 @@ test_posix_parse (void)
|
|
g_assert_cmpint (g_time_zone_get_offset (tz, i2), ==,- 7 * 3600);
|
|
g_assert (g_time_zone_is_dst (tz, i2));
|
|
g_time_zone_unref (tz);
|
|
+ g_date_time_unref (gdt1);
|
|
+ g_date_time_unref (gdt2);
|
|
|
|
tz = g_time_zone_new_identifier ("PST8PDT6:32:15");
|
|
#ifdef G_OS_WIN32
|
|
--
|
|
2.34.1
|
|
|