KItinerary
timezonedb.cpp
41[[nodiscard]] static bool compareOffsetData(const QTimeZone::OffsetData &lhs, const QTimeZone::OffsetData &rhs)
53 if (lhs.offsetFromUtc(dt) != rhs.offsetFromUtc(dt) || lhs.hasTransitions() != rhs.hasTransitions()) {
69QTimeZone KnowledgeDb::timezoneForLocation(float lat, float lon, QStringView alpha2CountryCode, QStringView regionCode)
76 auto countryTzs = KCountrySubdivision::fromCode(QString(alpha2CountryCode + QLatin1Char('-') + regionCode)).timeZoneIds();
84 // example: Tijuana airport ending up in America/Los Angeles, and America/Tijuna being the only MX timezone equivalent to that
85 if (coordTz && countryFromTz.isValid() && country.isValid() && !(countryFromTz == country)) { // ### clean up once KCountry has op!=
120 // if both timezones are equivalent, the country-based one wins, otherwise we use the coordinate one
128bool KnowledgeDb::isPlausibleTimeZone(const QTimeZone &tz, float lat, float lon, QStringView alpha2CountryCode, QStringView regionCode)
133 if (coordTzId && std::strcmp(coordTzId, "") != 0 && coordTz.isValid() && isEquivalentTimezone(tz, coordTz)) {
138 auto countryTzs = KCountrySubdivision::fromCode(QString(alpha2CountryCode + QLatin1Char('-') + regionCode)).timeZoneIds();
150 // if we were able to determine any timezone and none of them matched, we consider @p tz implausible
151 return (!coordTzId || std::strcmp(coordTzId, "") == 0 || !coordTz.isValid()) && countryTzs.isEmpty();
static KCountrySubdivision fromCode(const char *code)
QList< const char * > timeZoneIds() const
bool isValid() const
static KCountry fromAlpha2(const char *alpha2Code)
QList< const char * > timeZoneIds() const
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
KI18NLOCALEDATA_EXPORT const char * fromLocation(float latitude, float longitude)
KI18NLOCALEDATA_EXPORT KCountry country(const char *ianaId)
QDateTime currentDateTimeUtc()
bool hasTransitions() const const
bool isValid() const const
OffsetData nextTransition(const QDateTime &afterDateTime) const const
int offsetFromUtc(const QDateTime &atDateTime) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.