I have an application that works according to time, i.e. it behaves differently during certain hours and in a different manner other hours. But a user can change the system time and the application will fail(behave depending on the system time not the actual time). How to avoid this?
How to get the actual time even if the user changes the system time?
The user with administrator rights of the application sets a time period during which certain features of the application will be blocked. A normal user cannot use those blocked features during that time period fixed by the administrator but at other times he can use them. So during the actual blocked time period the normal user can change the system time to that time when he can use those features and can use it. I want to avoid this.
time set by Admin
allowed time period: 11 pm to 6 am
blocking time period: 6 am to 11 pm
now suppose it is 3 pm and the system clock is showing the correct time. My application checks the system time and blocks those features. But if the user changes the system time to say 11:30 pm he can use those features as they are no more blocked.
It is a desktop application that asks for password at its startup. If correct password is entered, admin is the user, if password is wrong or no password is entered, its normal user.
The person who installs the application will set the admin password and he is the admin.
Anybody can change the system time of a desktop.
Okay, the app could save the timestamp each time it validates the one, and prevent it from rolling back by stopping functioning. The function can be moved to a special server app the main app to communicate with. BTW, no guaranty against skilled hacker, and daylight saving time to be processed correctly.