Socket
Book a DemoInstallSign in
Socket

CronTimer

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

CronTimer

Simple .net Timer that is based on cron expressions with second accuracy to fire timer events to a very specific schedule.

Source
nugetNuGet
Version
2.0.0
Version published
Maintainers
1
Created
Source

CronTimer

Simple .net Timer that is based on cron expressions with second accuracy to fire timer events to a very specific schedule.

Regular timers are very useful for tasks that do not really require any precision like polling a service at a rough interval but sometimes there is a need for more precision based on time. There is already a great time schedule expression syntax that originated from Cron. Normally you would likely schedule such jobs via the operating system if they are things like on every Friday at 18:00 run a report but there are schedules that make more sense to have running in process like to not have a certain overhead of launching a whole job process or just because the process is already running. This small library makes it super easy to define such timers on a specific schedule.

Example

Fire a timer event every 10 minutes from Monday through Friday between 8:00 and 17:00

var timer = new CronTimer("*/10 08-17 * * 1-5", "Europe/Amsterdam", includingSeconds: false);
timer.OnOccurence += (s, ea) => Console.Out.WriteLineAsync(ea + " - " + DateTime.Now);
timer.Start();

Keywords

cron

FAQs

Package last updated on 29 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts