For my MFC/C++ unmanaged time-limited software needs, I'd like to get a GMT/UTC time-stamp from the internet (instead of relying on the PC clock time that can be easily changed).
I already though about parsing the line "Current UTC"... line from http://www.timeanddate.com/worldclock/ (I think port 80 is more likely to be open than others) but I don't know how reliable this URL is...
Please share with me your pros/cons or different ideas on this.
Thanks.
Use a SNTP (Simple Network Time Protocol) to get the time from an internet atomic clock.
There's a few libraries available on the web - here's one for MFC on codeproject.
Looks feasible and this is widely done.
Scraping of timeanddate.com can break if the site decides to change its HTML. Even a slight change in the HTML can break your scraper.
I would suggest you use a web service like earthtools. You'll have to pass the necessary arguments(latitude and longitude etc) in the URL and the response is XML which you can easily parse.
Make your program better instead of wasting time trying to protect it. Any such protection that you can do will be circumvented easily. If you insist, you can run the software on your server, as this is the only way to actually enforce such limits.
Well, To conclude:
My app contains an offline database that is updated once a day from the intranet.
I'd like to shred this database if it was not updated over a week and that's why I'd like to try and reduce the possibility of someone just changing the PC clock backwards.
I am fully aware of the fact that there are power users that could block my app from getting internet time in 20 different ways, but I'm trying to do the best I can in software (a hardware solution, e.g. a dongle, is an overkill for me).
Since I want to have a port 80 solution, I'll adopt codaddict's solution (earthtools) and will sample the PC clock otherwise.
Thanks for all the replies!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With