Explicitly disambiguate local time zone from UTC

Don't rely on time zone offset to check whether it is local as this
doesn't, and can't, work for the local time zone in Great Britain which
uses the same offset as UTC, but does use DST, unlike the latter.

Add a unit test (albeit disabled by default) checking that the code that
previously didn't work correctly in BST does work now (run the tests
using "TZ=Europe/London ./test wxDateTime-BST-bugs" under Unix to test).

Closes #14317, #17220.

See #10445.
This commit is contained in:
Vadim Zeitlin
2017-11-29 22:58:06 +01:00
parent f13b7c6a55
commit 543c522cb8
4 changed files with 48 additions and 6 deletions

View File

@@ -306,7 +306,9 @@ public:
return tz;
}
long GetOffset() const { return m_offset; }
bool IsLocal() const { return m_offset == -1; }
long GetOffset() const;
private:
// offset for this timezone from GMT in seconds