Do not speak English well. I try to write as much as possible.
I ask for a way to manage system time or program time with certainty.
I am creating a specific program evaluation version.
I created a class library to generate a license file and check the license expiration time. And I am comparing the current time with the license expiration time in a specific module through the class library.
License validation can be controlled using the current time and license time using Datetime.Compare. However, if an arbitrary user intentionally adjusts the system time, the program can be used indefinitely. This is because if you keep only the middle time (?) Between the license expiration time and the current time, you can continue to use it.
What I have tried:
This is the idea I tried to try.
1. I can not compare time with time.windows.com because it is not a network environment.
2. Environment.TickCount has a time limit of 24.9 days.
3. Microsoft.Win32.SystemEvents.TimeChanged Assuming you use it, you do not know if the time has changed in advance before you start the program.
4. I considered how to use Microsoft.Win32.SystemEvents.TimeChanged together with the license file access time. However, unlimited use is possible. Because you can set it to the middle time.
5. I also considered the registry count.
The disadvantage is that if you continue to run arbitrarily, you will not be able to run it sometime.