I'm going to send my timestamp to server and server will check if it is in a given interval. What if My mobile clock is not adjusted (say it gives 2:00 pm while now it is 2:00 am). now I lost the server. How should I handle such a situation.

  • 4
    Looks like the end of your question may have been cut off. Could you complete it please? – Xander Jun 30 '14 at 17:40

You either need to take system management seriously and use NT, or you could make an extra endpoint on your server poll the server for it's time.

For example, you could send a request to the server and record the request timestamp. The server should respond back with it's timestamp, and then the client can figure out the difference here and adjust your timestamp accordingly.

This way, your data will by in sync with the server minus a few nanoseconds/seconds.

client   ---get timestamp--> SERVER
client   <---137000881---    SERVER
client   -- your request --> SERVER

Not the answer you're looking for? Browse other questions tagged or ask your own question.