# class Spec

###

Module | kdecore
Namespace | KDateTime
Class | Spec
Inherits |

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.

### methods

- ClockTime ( )

  returns KDateTime.Spec
  static

  The ClockTime time specification. Provided as a shorthand for KDateTime.Spec(KDateTime.ClockTime).

- LocalZone ( )

  returns KDateTime.Spec
  static

  Returns a local time zone time specification. Provided as a shorthand for KDateTime.Spec(KDateTime.LocalZone).

  Returns Local zone time specification

- OffsetFromUTC (utcOffset)

  returns KDateTime.Spec
  static

  Argument | Type | Default
  --- | --- | ---
  utcOffset | int |

  Returns a UTC offset time specification. Provided as a shorthand for KDateTime.Spec(KDateTime.OffsetFromUTC, utcOffset).

  utcOffset - number of seconds to add to UTC to get the local time Returns UTC offset time specification

- Spec ( )

  returns ctor

  Constructs an invalid time specification.

- Spec (tz)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  tz | KTimeZone |

  Constructs a time specification for a given time zone. If tz is KTimeZone.utc(), the time specification type is set to UTC.

  tz - time zone

- Spec (type, utcOffset)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  type | KDateTime.SpecType |
  utcOffset | int | 0

  Constructs a time specification.

  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 not OffsetFromUTC.

- Spec (spec)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  spec | KDateTime.Spec |

  Copy constructor.

- UTC ( )

  returns KDateTime.Spec
  static

  The UTC time specification. Provided as a shorthand for KDateTime.Spec(KDateTime.UTC).

- equivalentTo (other)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  other | KDateTime.Spec |

  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 type OffsetFromUTC with a zero UTC offset.

  Returns true if the two instances are equivalent, false otherwise

  See also operator==()

- isClockTime ( )

  returns bool

  Returns whether the time specification is a local clock time.

  Returns true if local clock time

  See also isUtc(), timeZone()

- isLocalZone ( )

  returns bool

  Returns whether the time specification is the current local system time zone.

  Returns true if local system time zone

  See also isUtc(), isOffsetFromUtc(), timeZone()

- isOffsetFromUtc ( )

  returns bool

  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()

- isUtc ( )

  returns bool

  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()

- isValid ( )

  returns bool

  Returns whether the time specification is valid.

  Returns true if valid, else false

- operator != (other)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  other | KDateTime.Spec |

- operator == (other)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  other | KDateTime.Spec |

  Comparison operator.

  Returns true if the two instances are identical, false otherwise

  See also equivalentTo()

- setType (type, utcOffset)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  type | KDateTime.SpecType |
  utcOffset | int | 0

  Initialises the time specification.

  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 not OffsetFromUTC.

  See also type(), setType(const KTimeZone&)

- setType (tz)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  tz | KTimeZone |

  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.

  tz - new time zone

  See also timeZone(), setType(SpecType)

- timeZone ( )

  returns KTimeZone

  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()

- type ( )

  returns KDateTime.SpecType

  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()

- utcOffset ( )

  returns int

  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()