Subscribe to a time change event in the local system

Is there a way my winforms C # application knows when the date and time settings were changed on the local computer.

0
source share
2 answers

Yes, you want to take a look at SystemEvents.TimeChanged .

Microsoft.Win32.SystemEvents.TimeChanged += new EventHandler(SystemEvents_TimeChanged); void SystemEvents_TimeChanged(object sender, EventArgs e) { // The system time was changed } 

From the documentation:

Occurs when the user changes the time on the system clock.

+5
source

I think SystemEvents.TimeChanged is what you are looking for.

+2
source

Source: https://habr.com/ru/post/1497008/


All Articles