// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.Threading; namespace TimPer10 { public class Program { public async static Task Test() { PeriodicTimer t = new PeriodicTimer(TimeSpan.FromSeconds(3)); while(await t.WaitForNextTickAsync()) { Console.WriteLine(DateTime.Now); } } public static void Main(string[] args) { Test(); Console.WriteLine("Press enter to exit"); Console.ReadKey(); } } }