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:
@@ -254,6 +254,17 @@ public:
|
||||
/// Create a time zone with the given offset in seconds.
|
||||
static TimeZone Make(long offset);
|
||||
|
||||
/**
|
||||
Return true if this is the local time zone.
|
||||
|
||||
This method can be useful for distinguishing between UTC time zone
|
||||
and local time zone in Great Britain, which use the same offset as
|
||||
UTC (i.e. 0), but do use DST.
|
||||
|
||||
@since 3.1.1
|
||||
*/
|
||||
bool IsLocal() const;
|
||||
|
||||
/// Return the offset of this time zone from UTC, in seconds.
|
||||
long GetOffset() const;
|
||||
};
|
||||
|
Reference in New Issue
Block a user