public void Run() { for (;;) { Thread.Sleep(100); DateTime now = DateTime.Now; if (now.Second != second) { TimeInfoEventArg timeInfoEventArg = new TimeInfoEventArg(now.Hour, now.Minute, now.Second); if (SecondChanged != null) { SecondChanged(this, timeInfoEventArg); } } } }
public void LogTime(object o, TimeInfoEventArg e) { Console.WriteLine($"Logging {e.Hour.ToString()} {e.Minute.ToString()}{e.Second.ToString()}"); }
public void NewTime(object o, TimeInfoEventArg e) { Console.WriteLine($"Current time: {e.Hour.ToString()} {e.Minute.ToString()}{e.Second.ToString()}"); }