I am trying to run a function every 2 milliseconds but setting a timer to 2 milliseconds its not working it looks like it works every 50 milliseconds or so.. and when I try to use a While loop with Date.UtcNow.Ticks to compare 2 milliseconds then the CPU goes high. What options do I have here?
Asked
Active
Viewed 291 times
1
-
2firstly decide if you're using c# or vb.net .. – BugFinder Aug 01 '16 at 07:51
-
1its the same thing – PaulWill Aug 01 '16 at 07:53
-
4No its not.. the are very similar but decide which one you're using as different groups of people look at different questions.. if your code is vb then the vb people care, if not the c# people care.. and yes there are differences – BugFinder Aug 01 '16 at 07:56
-
Look at this questions: https://stackoverflow.com/questions/7137121/high-resolution-timer https://stackoverflow.com/questions/26402688/c-sharp-how-can-i-make-a-microsecond-timer http://www.codeproject.com/Articles/98346/Microsecond-and-Millisecond-NET-Timer Key Word = micro timer – Jernej Pirc Aug 01 '16 at 07:53
1 Answers
0
Depending on OS and Hardware configuration, system will allocate time slot to each process/thread,
You can try with on threading which will run full time and put statement thread.sleep(2);
for delay and then run your code again in infinite while loop.

JPatel
- 103
- 1
- 6