qt5base-lts/tests/auto/corelib/tools/qtimezone
Edward Welbourne ab2655c559 Support POSIX rules as $TZ values
The TZ environment variable can validly contain a POSIX rule, rather
than an IANA ID, as described here:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03

However, if TZ were set to such a value, leading to it being used as
systemTimeZoneId(), it would be passed to QTzTimeZonePrivate::init(),
which is a no-op unless it manages to open a zoneinfo/ file with the
given ianaId as name.  When the environment variable doesn't name a
zoneinfo/ file, we would thus get an invalid time-zone.  We can,
instead, check whether the ianaId looks like a valid POSIX rule and,
if it does, use it as m_posixRule, enabling us to correctly handle
this case.

Tweak parsing of POSIX rules so that a zone using name "UTC" or "GMT"
with an offset other than 0 will be rejected as invalid.  This avoids
parsing a zone name such as "GMT+17" or "UTC+00:01" as a POSIX rule,
where it should be understood as an offset from UTC (and only certain
well-established offsets are supported).

Added two test-cases to tst_QTimeZone::tzTest() for validity of a
POSIX zone value - a simple one constructed during discussion of the
bug, the other taken from an example in:
http://leaf.sourceforge.net/doc/buci-tz3.html

Task-number: QTBUG-75565
Change-Id: Ia5cb1cc56b13b0f6b56258e48be98d04d909e32a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-10 14:17:01 +00:00
..
BLACKLIST Android: tst_qtimezone: Blacklist a bunch 2018-06-27 07:52:26 +00:00
qtimezone.pro Adjust tst_QTimeZone's Q_OS_WIN #if-ery now that ICU is the default 2018-03-09 10:34:00 +00:00
tst_qtimezone_darwin.mm Add conversion functions for QTimeZone and CFTimeZone/NSTimeZone 2017-01-23 21:55:22 +00:00
tst_qtimezone.cpp Support POSIX rules as $TZ values 2019-05-10 14:17:01 +00:00