How can I compare the time between an Iphone and a (web) server? -


I have an application that occasionally sends messages to the iPhone latency between two devices is important for the problem domain - If the message takes less than a second to arrive, then everything is fine; If it takes more than 5 seconds, then there is almost certainly a problem that the time of server-side messages is encapsulated with the time of the server.

Using cellular data connection, we sometimes see delays, but we can not tell them, because there is no guarantee that the iPhone's clock is synchronized to the server; One our test phone, we see different time for different carriers

Is there an easy way to synchronize time between the iPhone and the server? I (S) have seen NTP, which seems to go in the right way

Any option? We should only be accurate within seconds, not milliseconds.

I'm not sure what the exact position is, so it can be a non-solution , But:

assuming that you set the interval between the phone and the server (and only this) (fixed by the server). Assuming that the error is checked server-side, instead of syncing clocks, you can go with the "ping" approach.

  • The server ping client starts the iPhone, and stopwatch.
  • Client instant ping server.
  • As soon as the client accesses the ping server, the server stops the stopwatch and checks for time.

    If I misunderstood your problem, sorry.

Comments