Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clock.sync() sometimes responses with no TimeInterval #118

Open
patricks opened this issue Jul 19, 2024 · 0 comments
Open

Clock.sync() sometimes responses with no TimeInterval #118

patricks opened this issue Jul 19, 2024 · 0 comments

Comments

@patricks
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant