Link to home
Start Free TrialLog in
Avatar of pr2501
pr2501

asked on

Code For check system time and if system time was turned back?

I need code which can work with any windows OS and 64-bit addresses memory PCs?
Avatar of Beneford
Beneford
Flag of United Kingdom of Great Britain and Northern Ireland image

The now() function returns the current time.
To find out if the clock has been changed, you'll have to save the last-known-time and compare it with the now() function to see that it is monotonically increasing.
You can detect system time changes in your app with WM_TIMECHANGE...
How to prevent user changing system date/time (in Windows 7)?
ASKER CERTIFIED SOLUTION
Avatar of Thommy
Thommy
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pr2501
pr2501

ASKER

procedure TForm1.WMTimeChange(var Msg: TMessage) ;
begin
   inherited;
   ShowMessage('Date/Time has changed!') ;
end;

When will i get message above?
After system time/date has been changed...
Avatar of pr2501

ASKER

I which way,
by replacing of battery,
by clicking on adjust time/date,
by changing some registers in system?


I am looking for options  to have time licence in my app.
By using system functions to change date/time, either manually or programmatically...
Avatar of pr2501

ASKER

So changing date/time in taskbar is not starting this event?
Changing date/time in task bar is a system function, which should definitely cause a WMTimeChange message...
Avatar of pr2501

ASKER

Ok. It can go. I well be around if someone changes this seting by mistake.