0

Possible Duplicate:
How can I locally detect iPhone clock advancement by a user between app runs?

Is there is any way to check that Device Clock Time has been Modified Manually. Like NSSystemClockDidChangeNotification But this work Only when My application is working. Can we detect this when application is not working.

Community
  • 1
  • 1
Nik's
  • 690
  • 1
  • 10
  • 27
  • No, you cannot detect this change as far as I know, but maybe you can do it when your application resumes from the background? – borrrden Jan 04 '13 at 07:35
  • But If some one Change the Device time and perform some action then how can we record actual time of occurrence of that event. – Nik's Jan 04 '13 at 07:39
  • Why do you need to record their actions? It sounds like malware. – borrrden Jan 04 '13 at 07:46
  • Its Not a Malware. I want To record the Agents Time, When they actually perform the action. while they are sync. with the Server It can be done later at any time. Without this they can easily Cheat with the time when they perform Action – Nik's Jan 04 '13 at 07:49
  • If you are syncing with a server, then see the given answer. – borrrden Jan 04 '13 at 07:52
  • But at the time of Syncing Suppose he Correct the Device time.. – Nik's Jan 04 '13 at 07:53

2 Answers2

1

You can compare local time with a time server and store the difference. Then, on next run, do it again and see if the difference changed. You need to be connected to the Internet, though. If you don't have Internet connection, you can store your local time and check it on every run. Then you will be able to check if the local time has been reversed. You will not be able to check if it was moved forward.

Adam
  • 26,549
  • 8
  • 62
  • 79
  • He Perform some Event when he was offline with change of device time , But at the time of Syncing or Communicating with Server, Suppose he Correct the Device time. – Nik's Jan 04 '13 at 07:55
  • You cannot verify this without an internet connection. So, you have to disallow this behavior unless there is an active internet connection. Apple has no hardware for verifying time. More info in this answer: http://stackoverflow.com/questions/9868491/ios-real-time-for-specific-timezone-while-offline – borrrden Jan 04 '13 at 08:13
1

You can save the time before terminating the app and check on launch. If someone tries to cheat your app, probably he will set his clock only for a limited time(temporary). So you can check if time went back.

The time goes never back unless you change your time zone. So I would be carefully before blaming a user as a cheater. It is possible that he changed his time zone.

Mert
  • 6,025
  • 3
  • 21
  • 33