CronTimer/Demo/Program.cs
Simon Diesenreiter 216ebeaff5 initial commit
2025-04-15 13:14:56 +02:00

23 lines
539 B
C#

using System;
namespace Demo
{
class Program
{
static void Main()
{
var expression = "0-30/5 * * * * *";
Console.WriteLine(expression);
var timer = new CronTimer(expression, "Asia/Hong_Kong", includingSeconds: true);
timer.OnOccurence += (s, ea) => Console.WriteLine($"{ea.At:T} - {DateTime.Now}");
timer.Start();
while (Console.ReadKey().Key != ConsoleKey.Escape)
{
}
timer.Stop();
}
}
}