public void Run() { for (; ;) { DateTime dt = System.DateTime.Now; if (dt.Second == dt1.Second) { FiveSecondEventArgs timeinformation = new FiveSecondEventArgs(); timeinformation.date = dt; if (onFiveSecond != null) { onFiveSecond(this, timeinformation); dt1 = dt.AddSeconds(5); } } //this.second = dt.Second; } }
public void c_onSecondChange(object clock, FiveSecondEventArgs timeInformation) { Console.WriteLine(timeInformation.date.ToLocalTime()); }