I've been developing a simple program to stop my brother from playing on the computer from 12 am to 5 am because of his addiction, with his request to do so, but he is easily bypassing my system by changing the windows system time, I've been wondering if there an effective way of protecting the software of time changes
-
Maybe you could use REST service to get current time? https://stackoverflow.com/questions/13240530/free-rest-api-to-retrieve-current-datetime-as-string-timezone-irrelevant – Andrzej Kaczor Mar 06 '19 at 12:26
1 Answers
This is interesting. Here's a way. It's not 100% foolproof, but it should be enough if your brother doesn't know how to bypass it:
- Have your program keep the time when it was started in memory.
- Have your program start it's own clock.
- Ignore system time for "real time" purpose.
Let's say your program was started at 15:24:22. It'll remember that exact moment as it's baseline. At the same moment, you start a chronometer:
Dim chron As Stopwatch = Stopwatch.StartNew()
chron.Start()
From this point on, you need to access "Now" by adding the time elapsed on chron
and the baseline time you saved earlier. You should have a Function for this purpose.
If your brother tries to change system time, neither the chron nor the baseline will be affected, so his current method of bypass will not work. However, he could still change system time, then reboot, and at startup the program would save a new baseline and be fooled. Unless you tell him, though, I doubt that he will go this far.
Good luck and have fun!

- 3,138
- 2
- 14
- 21
-
He will but i could save data on the computer, so that would do the trick ill try it and ill see how it goes – AirWaste Mar 06 '19 at 13:05
-
Saving data is a good idea, but Andrzej Kaczor comment about using a webservice would make sure that your clock is always unbiased (unless your brother unplugs the internet, but he'll have to play offline then). If you're at ease with the idea, it would be the best solution IMO. – laancelot Mar 06 '19 at 13:08
-
Yeah ive been looking for one, and i even made my own very simple version at www.aragonloaders.ml/time but i just cant get the data correctly – AirWaste Mar 06 '19 at 14:17
-
What do you get if you do: `Dim webClient As New System.Net.WebClient Dim result As String = webClient.DownloadString("www.aragonloaders.ml/time")` ?? There are many ways to do this but I'm lazy so I would probably just regex the shit out of it. – laancelot Mar 06 '19 at 14:51
-
Okay thats the solution i used, ive used my simple api that gets the timezone from my webserver, that should do the trick ill post the code i used when i get home to help others that might need this solution – AirWaste Mar 07 '19 at 10:15