Get time from the Internet (bypassing the PC clock)?

For my unmanaged MFC / C ++ software needs, I would like to get the GMT / UTC timestamp from the Internet (instead of relying on a PC clock that can be easily changed).

I'm already talking about analyzing the Current UTC line ... a 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 and cons or various ideas.

Thanks.

+6
c ++ time protection trialware
source share
6 answers

It looks real, and it is widely done.

The scrambling of timeanddate.com may break if the site decides to change its HTML. Even a small change in HTML can break your scraper.

I would suggest you use a web service like earthtools . You will need to pass the necessary arguments (latitude and longitude, etc.) to the URL, and the response is XML, which you can easily parse.

+3
source share

Use SNTP (Simple Network Time Protocol) to get time from atomic clocks on the Internet.

Several libraries are available on the Internet - here for the MFC in the code project .

+7
source share

Make your program better, and do not waste time protecting it. Any such protection you can make will be easily circumvented. If you insist, you can run the software on your server, as this is the only way to actually enforce such restrictions.

+1
source share

Well, in conclusion: My application contains a standalone database that is updated once a day from the intranet.
I would like to destroy this database if it has not been updated for a week and why I would like to try to reduce the likelihood that someone will simply change the PC clock back.
I am fully aware of the fact that there are powerful users who can block my application from receiving Internet time in 20 different ways, but I try my best to try to use software (a hardware solution, for example, a key, is redundant for me).

Since I want to have a solution with port 80, I will make the decision codaddict (earthtools) and spend the other hours of the PC.

Thanks for all the answers!

+1
source share

Hmmm. Interesting. You are basically trying to use the Internet as a key.

If you really need this kind of โ€œprotectionโ€ over your software, you might want to consider getting a real key with a real-time clock in it, such as HASP . Of course, either soltion will be trivial to get around a decent hacker with a disassembler.

In general, I think it is better to open your software and try to live with patches, mods and support.

0
source share

The answer lies in your question ... Go to https://www.timeanddate.com/ and find the "API", you will find this page: https://www.timeanddate.com/services/api/ Detailed instructions: https: //services.timeanddate.com/api/packages/time.html Using your API, you send a request and get an XML or JSON response. It cost you $ 150 a year, but it's a professional way to do it, and it makes sense to charge you for your software.

0
source share

All Articles