Clock
struct Clock
Estimate host clock minus Watch clock from a live request. Exclude time spent processing the request.
-
Recent clock offset estimates with their network delay and local measurement time.
Declaration
Swift
private var samples: [(offset: TimeInterval, delay: TimeInterval, measured: Date)] -
The offset from the lowest-latency sample, or zero before a valid exchange.
Declaration
Swift
private var offset: TimeInterval { get } -
Records a valid request/reply exchange and discards outdated or inconsistent estimates.
Declaration
Swift
@discardableResult mutating func record(sent: Date, received: Date, hostReceived: Date, hostReplied: Date) -> BoolReturn Value
Whether the exchange supplied a usable clock sample.
-
Converts a time measured on the host clock to the Watch clock.
Declaration
Swift
func localDate(forHostDate date: Date) -> Date -
Converts a time measured on the Watch clock to the host clock.
Declaration
Swift
func hostDate(forLocalDate date: Date) -> Date
View on GitHub
Install in Dash