Skip to content

System Timer with 1 millisecond interval. #67088

@KSemenenko

Description

@KSemenenko

System timers that can be called once every 1 millisecond.

This is very difficult to do at the moment,. especially when it comes to cross-platform.
Perhaps we should add such a high-precision system timer, it will come in handy for games or playing MIDI file.

As you can see, for small intervals, 15.6 ms is the best average. As you know, this is the standard Windows system timer resolution, which you can read in detail in the document from Microsoft called Timers, Timer Resolution, and Development of Efficient Code (http://download.microsoft.com/download/3/0/2/3027d574-c433-412a-a8b6-5e0a75d5b237/timer-resolution.docx)

The default system-wide timer resolution in Windows is 15.6 ms, which means that every 15.6 ms the operating system
receives a clock interrupt from the system timer hardware.
The System.Timers.Timer class has the same resolution as the system clock.
This means that the Elapsed event will fire at an interval defined by the resolution of the system clock if the Interval property is less than the resolution of the system clock.

So as you can see, it cannot be done without using operating system specific functions. or implementing through infinite loop and Task.Wait/Thread.Sleep methods.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions