HighPrecisionTime

public struct HighPrecisionTime

Represents a high precision timestamp starting from UNIX epoch: 1970-01-01.

  • Current date represented in seconds passed since January 1st, 1970.

    Declaration

    Swift

    public let secondsSince1970: Int
  • Nanoseconds offset added to the current date.

    Declaration

    Swift

    public let nanosecondsOffset: Int
  • Declaration

    Swift

    public init(secondsSince1970: Int, nanosecondsOffset: Int = 0)

    Parameters

    secondsSince1970

    Number of seconds passed January 1st, 1970

    nanosecondsOffset

    Nanoseconds to be added to the initial date

  • Converts to a Foundation.Date.

    Note

    Truncates the nanosecond component.

    Declaration

    Swift

    public func toDate() -> Date
  • Converts a Foundation.Date into an instance of HighPrecisionTime.

    Note

    Sub-second components default to 0.

    Declaration

    Swift

    public init(date: Date)
  • Declaration

    Swift

    public init(secondsSince1970: Int, millisecondsOffset: Int)

    Parameters

    secondsSince1970

    Number of seconds passed January 1st, 1970

    millisecondsOffset

    Milliseconds to be added to the initial date

  • Declaration

    Swift

    public init(secondsSince1970: Int, microsecondsOffset: Int)

    Parameters

    secondsSince1970

    Number of seconds passed January 1st, 1970

    microsecondsOffset

    Microseconds to be added to the initial date

  • Declaration

    Swift

    public var description: String
  • Declaration

    Swift

    public static func == (left: HighPrecisionTime, right: HighPrecisionTime) -> Bool

    Parameters

    lhs
    rhs