0

I have been informed that Android's clock ticks are not reliable to use them in an application which heavily depends upon time being accurate to one second! If this is the case, then is there a reliable way available which can help develop the application?

Any thoughts / suggestions / advice will be appreciated.

Thanks.

  • You should not count on the ability to do anything at precise times on Android, at best you can determine how much time has actually elapsed before your the scheduler *lets* your code run. Broadly speaking, you have clocks which are corrected from external sources, and so do not necessarily advance steadily but try to be correct, and you have other clocks which advance accurately but might have the wrong time. However, on some early Android implementations CLOCK_MONOTONIC actually wasn't, as it was inappropriately subjected to corrections and could actually be observed to move backwards! – Chris Stratton Jun 13 '16 at 07:31
  • Thanks for the comment but I find it remarkably surprising that even with advancement in software and hardware for Android, we still can't really rely upon the clock ticks. Is this something Android (Google) admits itself ? – Khurram Khan Jun 13 '16 at 08:50
  • This is hardly unique to android, it might be a little more noticeable on a low power device running a heavy software stack but ordinary operating systems do not make realtime guarantees. You can find out how much time has passed, but not guarantee exactly when you will run. Alarm functionality is worth looking at. At present though you don't have a question specific enough to be answerable. – Chris Stratton Jun 13 '16 at 14:16
  • @ChrisStratton you are right, I didn't ask the question specific enough, the reason for that was that I wanted to be 100% sure that my knowledge was correct enough before I decided on an approach to use. Basically I want to build an application that calculates the lapsed time with a 100% guarantee of one second accuracy. What do you suggest what is good option available to try? Alarm functionality? – Khurram Khan Jun 14 '16 at 03:36

0 Answers0