I am working on a parental control Windows desktop application. A lot of actions/events depend on the correct system time. The problem is that I cant trust the system time because it can be changed. So whenever possible I want to somehow get the time from the internet. The time should be in UTC because I want it to work in different time zones. The solution doesnt have to be bulletproof. I know for sure that the kids will always find the way around it ;-) I want at least something that cant be tricked with two mouse clicks.
Currently I am considering these options to get the time:
- from the public NTP server. But I am afraid that the server might go down in the future.
- from the WebClient response header from a website like google.com I think that the response time is not in UTC and I am afraid that the web server might block the requests if they are too frequent.
- get a server UTC time from my own web server API. I think that this might be currently my best option.
It would also be great if I would be able to cache the time so that I would not have to sync it too often. I dont want to spam the time servers with requests every second.
For the caching part I was thinking something like storing the DateTime from the internet and system DateTime of the last synchronization. And computing the time based on these values.
What do you think is the best approach for getting and caching the correct UTC time from the internet?
Thanks a lot for your suggestions.