You can use an NTP server that tells you the time.
Until someone uses a proxy server to determine what the NTP server is connected to and then tricks the NTP response ... as others mention, the answer is easy to analyze and therefore easy to respond to.
The best solution would be to use something like the Google App Engine (for free) to send your application some kind of encrypted response that comes down to server time. If the client time deviates too much from this, the application will simply use the server time for calculations. Then even if they intercept the request, they cannot easily return the correct answer.
But basically in any multiplayer game you should always consider that the client is lying. The only real way to prevent problems is to let everything go through the server, so the client cannot decide that it is unexpectedly rich, and any other client agrees that this is so ...
source share