Clock

public struct Clock

Undocumented

  • UTC

    Obtains a clock that returns the current instant using the best available system clock, converting to date and time using the UTC time-zone.

    Declaration

    Swift

    public static var UTC: Clock { get }
  • GMT

    Obtains a clock that returns the current instant using the best available system clock, converting to date and time using the GMT time-zone.

    Declaration

    Swift

    public static var GMT: Clock { get }
  • The time zone currently used by the system.

    Declaration

    Swift

    public static var current: Clock { get }
  • The time zone currently used by the system, automatically updating to the user’s current preference. If this time zone is mutated, then it no longer tracks the system time zone. The autoupdating time zone only compares equal to itself.

    Declaration

    Swift

    public static var autoupdatingCurrent: Clock { get }
  • Obtains a clock that returns instants from the specified clock with the specified duration added

    Declaration

    Swift

    public static func offset(baseClock: Clock, offsetDuration: Int) -> Clock

    Parameters

    baseClock

    The base clock to add the duration to.

    offsetDuration

    The duration to add.

    Return Value

    A clock based on the base clock with the duration added.

  • Gets the offset second field.

    Declaration

    Swift

    public var offsetSecond: Int { get }
  • Gets the automatically updating status.

    Declaration

    Swift

    public var isAutoUpdatingFromCurrent: Bool
  • Returns an instance of LocalTime.

    Declaration

    Swift

    public func toTime() -> LocalTime
  • Returns an instance of TimeZone.

    Declaration

    Swift

    public func toTimeZone() -> TimeZone
  • Returns a time zone initialized with a given identifier.

    Declaration

    Swift

    public init(identifier: ClockIdentifierName)
  • Returns a time zone initialized with a given identifier.

    An example identifier is America/Los_Angeles.

    If identifier is an unknown identifier, then returns nil.

    Declaration

    Swift

    public init?(identifier: String)
  • Creates a time zone from an instance of TimeZone.

    Declaration

    Swift

    public init(_ timeZone: TimeZone = TimeZone.current)
  • Creates a time zone from a hour fields.

    Declaration

    Swift

    public init(offsetHour hour: Int)
  • Creates a time zone from a minute fields.

    Declaration

    Swift

    public init(offsetMinute minute: Int)
  • Creates a time zone from a second fields.

    Declaration

    Swift

    public init(offsetSecond second: Int)
  • Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.

    Declaration

    Swift

    public static func < (lhs: Clock, rhs: Clock) -> Bool
  • Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.

    Declaration

    Swift

    public static func > (lhs: Clock, rhs: Clock) -> Bool
  • Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.

    Declaration

    Swift

    public static func <= (lhs: Clock, rhs: Clock) -> Bool
  • Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.

    Declaration

    Swift

    public static func >= (lhs: Clock, rhs: Clock) -> Bool
  • The hash value.

    Hash values are not guaranteed to be equal across different executions of your program. Do not save hash values to use during a future execution.

    Declaration

    Swift

    public var hashValue: Int { get }
  • Returns a Boolean value indicating whether two values are equal.

    Declaration

    Swift

    public static func == (lhs: Clock, rhs: Clock) -> Bool
  • A textual representation of this instance.

    Declaration

    Swift

    public var description: String { get }
  • A textual representation of this instance, suitable for debugging.

    Declaration

    Swift

    public var debugDescription: String { get }
  • The custom mirror for this instance.

    If this type has value semantics, the mirror should be unaffected by subsequent mutations of the instance.

    Declaration

    Swift

    public var customMirror: Mirror { get }
  • Returns the custom playground description for this instance.

    If this type has value semantics, the instance returned should be unaffected by subsequent mutations if possible.

    Declaration

    Swift

    public var playgroundDescription: Any { get }
  • Creates a new instance by decoding from the given decoder.

    This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

    Declaration

    Swift

    public init(from decoder: Decoder) throws

    Parameters

    decoder

    The decoder to read data from.

  • Encodes this value into the given encoder.

    If the value fails to encode anything, encoder will encode an empty keyed container in its place.

    This function throws an error if any values are invalid for the given encoder’s format.

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws

    Parameters

    encoder

    The encoder to write data to.