-
Notifications
You must be signed in to change notification settings - Fork 96
Description
I sometimes have problems with Clock.sync() not returning a TimeInterval in the completion closure. After an analysis I found out that the problem lies in the NTPClient in private func offset(from responses: [[NTPPacket]]) throws -> TimeInterval. All server responses are filtered here by originTime (which is afaik ok). Now it can happen that certain responses take longer than 10 seconds (= kMaximumResultDispersion), especially if I use the default NTP server(s) time.apple.com with the default 4 samples. If this happens with the last response, no TimeInterval is returned. Although validate timeIntervals might have been returned beforehand. Is this done on purpose or would it also be possible to save the offsets in the sync() function (Clock.swift) and then return an average value at the end?
If I use the first closure I always get a valid offset (maybe there are cases where this response is also filtered).