protected void Weekly() { TimeSpan threadWait = LastUpdate.Add(Duration) - LastUpdate; Thread.Sleep((int)threadWait.TotalMilliseconds); Duration = new TimeSpan(7, 0, 0, 0, 0); // Add Seven Days, reached target day. LastUpdate = DateTime.Now; }
protected void Weekly() { TimeSpan threadWait = LastUpdate.Add(Duration) - LastUpdate; Thread.Sleep((int)threadWait.TotalMilliseconds); Duration = new TimeSpan(7, 0, 0, 0, 0); // Add Seven Days, reached target day. LastUpdate = DateTime.Now; }