PrecisionTimer.NET
3.0.0.7
dotnet add package PrecisionTimer.NET --version 3.0.0.7
NuGet\Install-Package PrecisionTimer.NET -Version 3.0.0.7
<PackageReference Include="PrecisionTimer.NET" Version="3.0.0.7" />
paket add PrecisionTimer.NET --version 3.0.0.7
#r "nuget: PrecisionTimer.NET, 3.0.0.7"
// Install PrecisionTimer.NET as a Cake Addin
#addin nuget:?package=PrecisionTimer.NET&version=3.0.0.7
// Install PrecisionTimer.NET as a Cake Tool
#tool nuget:?package=PrecisionTimer.NET&version=3.0.0.7
High Precision/High Resolution Timer that can safely achieve 1ms callbacks
Using a Precision Timer
is as simple as using any other Windows Timer
using PrecisionTiming;
public static PrecisionTimer MyTimer = new PrecisionTimer();
Basic Usage
Set Action
and Interval
and start the Precision Timer
MyTimer.SetInterval(SomeAction, Interval);
Check if the Precision Timer
is Running
MyTimer.IsRunning();
You can call SetInterval
again to change the Action
MyTimer.SetInterval(SomeDifferentAction, Interval);
Stop the Precision Timer
MyTimer.Stop();
Start the Precision Timer
Manually
MyTimer.Start();
Dispose the Precision Timer
MyTimer.Dispose();
SetInterval / Configure
If you use SetInterval
to set only Action
and Interval
the Precision Timer
will automatically start with the most common defaults, but it has several optional parameters you can change
For example, If you don't want the Precision Timer
to start automatically then use the following
MyTimer.SetInterval(SomeAction, Interval, false);
You can use Configure
instead of SetInterval
if you prefer
MyTimer.Configure(SomeAction, Interval, false);
Manual Setup
You can manually configure the Precision Timer
and then Start
it yourself instead of using SetInterval
SetAction
Sets the Action
that will be triggered by the TimerCallback
when the Period
has elapsed
MyTimer.SetAction(Action);
Periodic Timers
must stop before setting.
One Shot Timers
can change between shots, It is safer to stop.
SetPeriod / SetInterval(int)
Sets the Period (Interval) between Actions
in Milliseconds
.
MyTimer.SetPeriod(int);
MyTimer.GetPeriod();
Both Timer Modes
must stop before setting.
SetResolution
Set the Resolution
of the Precision Timer
before you start
MyTimer.Start(int);
The resolution is in milliseconds, The default resolution for SetInterval(Action)
is 0
The Resolution
increases with smaller values.
A resolution of 0 indicates periodic events should occur with the greatest possible accuracy.
To reduce system overhead, however, you should use the maximum value appropriate for your application.
The normal Resolution of a .Net Timer is around 12-15ms
SetEventArgs
Set EventArgs
of the Precision Timer
MyTimer.SetEventArgs(EventArgs);
MyTimer.GetEventArgs();
Periodic Timers
must stop before setting.
One Shot Timers
can change between shots, It is safer to stop.
SetAutoResetMode
Set the Periodic/OneShot Mode of the Precision Timer
MyTimer.SetAutoResetMode(bool);
MyTimer.GetAutoResetMode();
True
if the PrecisionTimer
should raise the Ticks
Event each time the interval elapses. (Periodic)
False
if the PrecisionTimer
should raise the event only once AFTER the first time the interval elapses. (One-Shot)
Both Timer Modes
must stop before setting.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on PrecisionTimer.NET:
Repository | Stars |
---|---|
Valkirie/HandheldCompanion
ControllerService
|
|
catright/Wale
Windows Audio Loudness Equalizer
|