KDECore
KTimezone Class Reference
The KTimezone class contains core functions related to a timezone. More...
#include <ktimezones.h>
Public Member Functions | |
QString | comment () const |
QDateTime | convert (const KTimezone *newZone, const QDateTime &dateTime) const |
QString | countryCode () const |
KTimezone (KSharedPtr< KTimezoneSource > db, const QString &name, const QString &countryCode=QString(), float latitude=UNKNOWN, float longitude=UNKNOWN, const QString &comment=QString()) | |
float | latitude () const |
float | longitude () const |
QString | name () const |
int | offset (const QDateTime &dateTime) const |
int | offset (Qt::TimeSpec basisSpec=Qt::UTC) const |
bool | parse (KTimezoneDetails &dataReceiver) const |
~KTimezone () | |
Static Public Member Functions | |
static bool | isValidLatitude (float latitude) |
static bool | isValidLongitude (float longitude) |
Static Public Attributes | |
static const float | UNKNOWN = 1000.0 |
Detailed Description
The KTimezone class contains core functions related to a timezone.Instances are created in the context of a KTimezoneSource which provides extended functionality via KTimezoneDetails.
- See also:
- KTimezoneSource
- Since:
- 3.5
Definition at line 85 of file ktimezones.h.
Constructor & Destructor Documentation
KTimezone::KTimezone | ( | KSharedPtr< KTimezoneSource > | db, | |
const QString & | name, | |||
const QString & | countryCode = QString() , |
|||
float | latitude = UNKNOWN , |
|||
float | longitude = UNKNOWN , |
|||
const QString & | comment = QString() | |||
) |
Create a timezone.
- Parameters:
-
db database of timezones. name in system-dependent format. countryCode ISO 3166 2-character country code, empty if unknown. latitude in degrees, UNKNOWN if not known. longitude in degrees, UNKNOWN if not known. comment description of the timezone, if any.
Definition at line 205 of file ktimezones.cpp.
KTimezone::~KTimezone | ( | ) |
Definition at line 224 of file ktimezones.cpp.
Member Function Documentation
QString KTimezone::comment | ( | ) | const |
Returns any comment for the timezone.
- Returns:
- comment, may be empty.
Definition at line 230 of file ktimezones.cpp.
Convert a date/time (which is interpreted as being localtime in this timezone) into localtime in the given timezone.
- Returns:
- converted date/time.
Definition at line 235 of file ktimezones.cpp.
QString KTimezone::countryCode | ( | ) | const |
Returns the two-letter country code of the timezone.
- Returns:
- ISO 3166 2-character country code, empty if unknown.
Definition at line 263 of file ktimezones.cpp.
bool KTimezone::isValidLatitude | ( | float | latitude | ) | [static] |
A test for a valid latitude.
The valid range is +90.0 (North Pole) to -90.0 (South Pole).
Definition at line 195 of file ktimezones.cpp.
bool KTimezone::isValidLongitude | ( | float | longitude | ) | [static] |
A test for a valid longitude.
The valid range is +180.0 (east of Greenwich) to -180.0 (west of Greenwich).
Definition at line 200 of file ktimezones.cpp.
float KTimezone::latitude | ( | ) | const |
Returns the latitude of the timezone.
- Returns:
- latitude in degrees, UNKNOWN if not known.
Definition at line 268 of file ktimezones.cpp.
float KTimezone::longitude | ( | ) | const |
Returns the latitude of the timezone.
- Returns:
- latitude in degrees, UNKNOWN if not known.
Definition at line 273 of file ktimezones.cpp.
QString KTimezone::name | ( | ) | const |
Returns the name of the timezone.
- Returns:
- name in system-dependent format.
Definition at line 278 of file ktimezones.cpp.
int KTimezone::offset | ( | const QDateTime & | dateTime | ) | const |
Returns the offset of the given timezone to UTC at the given date/time (which is interpreted as being UTC).
- Returns:
- offset in seconds.
Definition at line 309 of file ktimezones.cpp.
int KTimezone::offset | ( | Qt::TimeSpec | basisSpec = Qt::UTC |
) | const |
Returns the current offset of this timezone to UTC or the local timezone in seconds.
Take care if you cache the results of this routine; that would break if the result were stored across a daylight savings change.
- Returns:
- offset in seconds.
Definition at line 283 of file ktimezones.cpp.
bool KTimezone::parse | ( | KTimezoneDetails & | dataReceiver | ) | const |
Extract timezone detail information.
- Returns:
- true if the parse encountered no errors.
Definition at line 320 of file ktimezones.cpp.
Member Data Documentation
const float KTimezone::UNKNOWN = 1000.0 [static] |
A representation for unknown locations; this is a float that does not represent a real latitude or longitude.
Definition at line 92 of file ktimezones.h.
The documentation for this class was generated from the following files: