giammin

Detecting a System Time Change

Jan 27th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. using Microsoft.Win32;
  2.  
  3. static void Main()
  4. {
  5.     //The SystemEvents class provides the ability to respond to specific types of system events.
  6.     //http://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents(v=vs.110).aspx
  7.     SystemEvents.TimeChanged += SystemEvents_TimeChanged;
  8.     Console.ReadLine();
  9. }
  10.  
  11. static void SystemEvents_TimeChanged(object sender, EventArgs e)
  12. {
  13.     Console.WriteLine("Time changed");
  14. }
Advertisement
Add Comment
Please, Sign In to add comment