What are the major differences in the clocks provided by the App framework in android?
What are the major differences in the clocks provided by the App framework in android? How can i harness it to get some secure Real time?
From the developer link http://developer.andr开发者_运维问答oid.com/reference/android/os/SystemClock.html
I understand that there are three kinds of clocks. I would like to know which one should i use for calculating the expiry periods of some licenses i have.
How is that handled when the user switches off the device?
To get the "best" real time, you have to connect to an NTP server you rely on, and use the time information from that server. This has the drawbacks that you'll need internet connection, and that it can be too circumvented (if you have root on the device a simple hosts file might do it)
As previously mentioned the "wall" clock is settable by the user (so he can change it back), and the other two is only counted from the boot time, so it is resetted each boot.
You might also check Android Application Licencing too.
I think no one of these clocks are suitable for your needs.
First one (the "wall" clock) can be adjusted by user, second and third ones depends on uptime, thus will count from zero each device restart.
精彩评论