Philip Withnall 7ab9359af0 gtimezone: Fix assertion failure when called with a huge offset
This looks like a regression from commit 3356934db5, but prior to that
commit there was always an assertion failure when calling
`g_time_zone_new_offset()` with an offset which is too large (such as 44
hours), ever since the function was added in commit cf24867b93.

It would be ideal if we could return a `NULL` timezone to indicate the
error, but that’s not part of the API for `g_time_zone_new_offset()`, so
we have to go with the dated and not-ideal approach of returning the UTC
timezone and letting the caller figure it out.

Another potential approach would be to reduce the `offset` modulo 24
hours. This makes the error less easily detectable than if returning
UTC, though, and still returns an invalid result: `+44:00` is not the
same timezone as `+20:00` (it’s one day further ahead).

Add a unit test.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2620
2022-03-16 12:52:13 +00:00
..
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2019-05-27 17:51:40 +00:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2020-06-23 10:49:44 +01:00
2017-05-24 11:58:19 +02:00
2021-07-29 10:09:27 -04:00
2017-05-24 11:58:19 +02:00
2021-05-28 17:15:46 +02:00
2017-05-24 11:58:19 +02:00
2022-01-18 22:19:55 +01:00
2022-01-18 22:19:55 +01:00
2021-11-26 12:24:23 +00:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2020-11-17 15:50:07 +00:00
2022-02-01 17:09:14 -08:00
2018-01-04 22:19:30 +01:00
2019-11-25 13:09:25 +01:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2022-02-11 14:44:09 +00:00
2021-09-21 09:41:29 +00:00
2021-11-18 14:32:09 +00:00
2017-05-24 11:58:19 +02:00
2019-03-15 21:30:22 +01:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2021-07-21 13:49:48 +02:00
2021-09-21 09:41:29 +00:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2019-11-25 13:09:25 +01:00
2017-05-24 11:58:19 +02:00
2021-12-24 20:11:39 +00:00
2020-05-12 12:41:22 +01:00
2021-03-23 11:36:57 +00:00
2021-03-23 11:36:57 +00:00
2017-05-24 11:58:19 +02:00
2021-09-21 09:41:29 +00:00
2021-09-21 09:41:29 +00:00
2017-05-24 11:58:19 +02:00
2021-09-21 09:41:29 +00:00
2021-11-22 12:22:54 +00:00
2021-12-24 20:11:39 +00:00
2021-08-02 14:52:06 +01:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00