Change system uptime in a Windows application

I have a Windows application, and I want any event when the user changes the time during which this Windows program is open or running.

How can I get this change time or a specific time or any change of time / date system change?

+4
source share
2 answers

You can subscribe to the SystemEvents.TimeChanged event.

To subscribe to a previous event, do the following:

1.Create a TimeChanged EventHander.

private void time_Changed(object sender, EventArgs e) { MessageBox.Show("Time Changed"); } 

2. Add an event handler to the SystemEvents.TimeChanged event.

  SystemEvents.TimeChanged += time_Changed; 
+7
source

...or any event of system change of time/date? SystemEvents.TimeChanged only starts "when the user changes the time on the system clock."

Changes to the system time may also occur due to a change in system time initiated by the system or user. You can use the GetSystemTimeAdjustment function to fix such system time settings.

0
source

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


All Articles