Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QTimeZone: short-cut the empty-name case for the system zone and its id
The systemTimeZoneId() delegated to systemTimeZone() in a way that worked - but wasn't easy to follow - in the case where the backend's systemTimeZoneId() failed but its default constructor succeeds. This went via the QTimeZone(id) constructor, relying on its handling of empty id (which gets the system zone, unlike the default constructor which gets an invalid zone). When it gets an empty id, it falls back to newBackendTimeZone(), which uses the default constructor of the backend; and we have (and are even accessing the backend methods via) a default-constructed backend, so can simply share that with global_tz. This, if nothing else, saves repeating the systemTimeZone() look-up for the system ID when delegated to by systemTimeZoneId(). There's a risk that this might miss a change to the system configuration since the global_tz was initialized, but it's only used in a fallback and backends tend to cache this information anyway. When we come to address QTBUG-56899, we can have the refresh function update the global_tz object. Pick-to: 6.8 Change-Id: I8541e74f378e92af5a2a7187a49a9eb14a66c744 Reviewed-by: Thiago Macieira <[email protected]>
- Loading branch information