KDECore
#include <kdatetime.h>
Public Member Functions | |
Spec () | |
Spec (const KTimeZone &tz) | |
Spec (SpecType type, int utcOffset=0) | |
Spec (const Spec &spec) | |
~Spec () | |
bool | equivalentTo (const Spec &other) const |
bool | isClockTime () const |
bool | isLocalZone () const |
bool | isOffsetFromUtc () const |
bool | isUtc () const |
bool | isValid () const |
bool | operator!= (const Spec &other) const |
Spec & | operator= (const Spec &spec) |
bool | operator== (const Spec &other) const |
void | setType (SpecType type, int utcOffset=0) |
void | setType (const KTimeZone &tz) |
KTimeZone | timeZone () const |
SpecType | type () const |
int | utcOffset () const |
Static Public Member Functions | |
static Spec | ClockTime () |
static Spec | LocalZone () |
static Spec | OffsetFromUTC (int utcOffset) |
static Spec | UTC () |
Detailed Description
The full time specification of a KDateTime instance.
This specifies how the date/time component of the KDateTime instance should be interpreted, i.e. which time zone (if any) the date/time is expressed in.
Definition at line 223 of file kdatetime.h.
Constructor & Destructor Documentation
KDateTime::Spec::Spec | ( | ) |
Constructs an invalid time specification.
Definition at line 116 of file kdatetime.cpp.
KDateTime::Spec::Spec | ( | const KTimeZone & | tz | ) |
Constructs a time specification for a given time zone.
If tz
is KTimeZone::utc(), the time specification type is set to UTC
.
- Parameters
-
tz time zone
Definition at line 122 of file kdatetime.cpp.
KDateTime::Spec::Spec | ( | SpecType | type, |
int | utcOffset = 0 |
||
) |
Constructs a time specification.
- Parameters
-
type time specification type, which should not be TimeZone
utcOffset number of seconds to add to UTC to get the local time. Ignored if type
is notOffsetFromUTC
.
Definition at line 128 of file kdatetime.cpp.
KDateTime::Spec::Spec | ( | const Spec & | spec | ) |
Copy constructor.
Definition at line 134 of file kdatetime.cpp.
KDateTime::Spec::~Spec | ( | ) |
Destructor.
Definition at line 140 of file kdatetime.cpp.
Member Function Documentation
|
static |
The ClockTime time specification.
Provided as a shorthand for KDateTime::Spec(KDateTime::ClockTime).
Definition at line 211 of file kdatetime.cpp.
Checks whether this instance is equivalent to another.
The two instances are considered to be equivalent if any of the following conditions apply:
- both instances are type
ClockTime
. - both instances are type
OffsetFromUTC
and their offsets from UTC are equal. - both instances are type
TimeZone
and their time zones are equal. - both instances are UTC. An instance is considered to be UTC if it is either type
UTC
, or is typeOffsetFromUTC
with a zero UTC offset.
- Returns
true
if the two instances are equivalent,false
otherwise
- See also
- operator==()
Definition at line 230 of file kdatetime.cpp.
bool KDateTime::Spec::isClockTime | ( | ) | const |
Returns whether the time specification is a local clock time.
- Returns
true
if local clock time
- See also
- isUtc(), timeZone()
Definition at line 217 of file kdatetime.cpp.
bool KDateTime::Spec::isLocalZone | ( | ) | const |
Returns whether the time specification is the current local system time zone.
- Returns
true
if local system time zone
- See also
- isUtc(), isOffsetFromUtc(), timeZone()
Definition at line 216 of file kdatetime.cpp.
bool KDateTime::Spec::isOffsetFromUtc | ( | ) | const |
Returns whether the time specification is a local time at a fixed offset from UTC.
- Returns
true
if local time at fixed offset from UTC
- See also
- isLocal(), isUtc(), utcOffset()
Definition at line 218 of file kdatetime.cpp.
bool KDateTime::Spec::isUtc | ( | ) | const |
Returns whether the time specification is a UTC time.
It is considered to be a UTC time if it is either type UTC
, or is type OffsetFromUTC
with a zero UTC offset.
- Returns
true
if UTC
- See also
- isLocal(), isOffsetFromUtc(), timeZone()
Definition at line 202 of file kdatetime.cpp.
bool KDateTime::Spec::isValid | ( | ) | const |
Returns whether the time specification is valid.
- Returns
true
if valid, elsefalse
Definition at line 215 of file kdatetime.cpp.
|
static |
Returns a local time zone time specification.
Provided as a shorthand for KDateTime::Spec(KDateTime::LocalZone).
- Returns
- Local zone time specification
Definition at line 212 of file kdatetime.cpp.
|
static |
Returns a UTC offset time specification.
Provided as a shorthand for KDateTime::Spec(KDateTime::OffsetFromUTC, utcOffset).
- Parameters
-
utcOffset number of seconds to add to UTC to get the local time
- Returns
- UTC offset time specification
Definition at line 213 of file kdatetime.cpp.
Definition at line 368 of file kdatetime.h.
KDateTime::Spec & KDateTime::Spec::operator= | ( | const Spec & | spec | ) |
Assignment operator.
Definition at line 145 of file kdatetime.cpp.
Comparison operator.
- Returns
true
if the two instances are identical,false
otherwise
- See also
- equivalentTo()
Definition at line 221 of file kdatetime.cpp.
void KDateTime::Spec::setType | ( | SpecType | type, |
int | utcOffset = 0 |
||
) |
Initialises the time specification.
- Parameters
-
type the time specification type. Note that TimeZone
is invalid here.utcOffset number of seconds to add to UTC to get the local time. Ignored if spec
is notOffsetFromUTC
.
- See also
- type(), setType(const KTimeZone&)
Definition at line 158 of file kdatetime.cpp.
void KDateTime::Spec::setType | ( | const KTimeZone & | tz | ) |
Sets the time zone for the time specification.
To set the time zone to the current local system time zone, setType(LocalZone) may optionally be used instead.
- Parameters
-
tz new time zone
- See also
- timeZone(), setType(SpecType)
Definition at line 180 of file kdatetime.cpp.
KTimeZone KDateTime::Spec::timeZone | ( | ) | const |
Returns the time zone for the date/time, according to the time specification type as follows:
TimeZone
: the specified time zone is returned.UTC
: a UTC time zone is returned.LocalZone
: the current local time zone is returned.
- Returns
- time zone as defined above, or invalid in all other cases
- See also
- isUtc(), isLocal()
Definition at line 193 of file kdatetime.cpp.
KDateTime::SpecType KDateTime::Spec::type | ( | ) | const |
Returns the time specification type, i.e.
whether it is UTC, has a time zone, etc. If the type is the local time zone, TimeZone
is returned; use isLocalZone() to check for the local time zone.
- Returns
- specification type
- See also
- isLocalZone(), isClockTime(), isUtc(), timeZone()
Definition at line 214 of file kdatetime.cpp.
|
static |
The UTC time specification.
Provided as a shorthand for KDateTime::Spec(KDateTime::UTC).
Definition at line 210 of file kdatetime.cpp.
int KDateTime::Spec::utcOffset | ( | ) | const |
Returns the UTC offset associated with the time specification.
The UTC offset is the number of seconds to add to UTC to get the local time.
- Returns
- UTC offset in seconds if type is
OffsetFromUTC
, else 0
- See also
- isOffsetFromUtc()
Definition at line 219 of file kdatetime.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:13 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.