473,538 Members | 16,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is the minimum value of a Timer

Ken
Is there a limit to how low you can set a timer?

I know it can be set to 1 millisecond, but will it fire that often?

Isn't it something like 50 milliseconds and any lower will make no
difference?

Thanks,
Ken
Nov 23 '05 #1
5 4818
Ken,

When i use a performance counter i get the following values.

Calls to the Timer1_Tick Sub (with very little code in the sub)
50 ms = about 16 calls
10 ms = about 65 calls
1 ms = about 64 calls

Greetings,
Oldschool2

Nov 23 '05 #2
Ken wrote:
Is there a limit to how low you can set a timer?

I know it can be set to 1 millisecond, but will it fire that often?

Isn't it something like 50 milliseconds and any lower will make no
difference?

Thanks,
Ken

The standard PC clock interrupts every 18 and a bit milliseconds. I
suspect that is the granularity of the timer.
Nov 23 '05 #3
Ken,
In addition to the other comments.

Which timer are you referring to? There are 3 timers in .NET:
System.Timers.Timer, System.Threading.Timer, and System.Windows.Forms.Timer.

Comparing the Timer Classes in the .NET Framework Class Library
http://msdn.microsoft.com/msdnmag/is...T/default.aspx

Implement a Continuously Updating, High_Resolution Time Provider for Windows
http://msdn.microsoft.com/msdnmag/is...r/default.aspx
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Ken" <ks***@s32443t.com> wrote in message
news:e1*************@TK2MSFTNGP10.phx.gbl...
| Is there a limit to how low you can set a timer?
|
| I know it can be set to 1 millisecond, but will it fire that often?
|
| Isn't it something like 50 milliseconds and any lower will make no
| difference?
|
| Thanks,
| Ken
|
|
Nov 23 '05 #4
Ken,

I don't know where you can find the exact granularity but when you add
a performance counter to the tick events you will find some rough
figures.

System.Windows.Forms.Timer:
Then the maximum rate (interval = 1 ms) will be 64 calls each second to
the Timer1_Tick Sub.

System.Timers.Timer.Timer:
Then the maximum rate (interval = 1 ms) will be 128 calls each second
to the oTimer_Tick Sub.

But more important you can not rely on the counter because if you ad
more complex code to the tick event the figures will be lower than the
figures above.

Greetings,

Marcel Wiegand

Nov 23 '05 #5
Ken,

I also found a utility on sysinternals.com
http://www.sysinternals.com/utilities/clockres.html

With this utility you can find the maximum resolution of the timer.

The utility is called ClockRes.

Greetings,

Marcel Wiegand

Nov 28 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1706
by: Jonas Kölker | last post by:
Hello. I'm doing a Rubik's Cube timer, so I need a function to measure 100ths of a second. I've browsed through the library reference of python.org, but I didn't find anything that struck me as 'the perfect fit'. Either it was system dependent, or it was too grainy (lo-res), or... something else. so, I need a function which satisfies (in...
6
23432
by: WindAndWaves | last post by:
Hi Folks I have inhereted a script that I understand reasonably well, I just do not understand !/^\d+$/.test(el.value) what the hell does that mean? Below is the script (there are really three and they validate a four items
3
9065
by: RobG | last post by:
I would like a query that will tell me the minimum non-zero value in a row. Say I have a table with a column called recordID that contains unique record IDs, and have a set of values named V1, V2 up to V9 that I want to find the minimum value for each record. The values are decimal floating point numbers, some of the columns contain zeros...
86
3845
by: Randy Yates | last post by:
In Harbison and Steele's text (fourth edition, p.111) it is stated, The C language does not specify the range of integers that the integral types will represent, except ot say that type int may not be smaller than short and long may not be smaller than int. They go on to say, Many implementations represent characters in 8 bits, type...
23
73777
by: EOS | last post by:
Hi, As the title indicated, does anyone know the equivalent of GetTickCount() function in C/C++ for C#? The function is supposed to return time elapsed since the computer/device is booted in milisecond. By te waym thanks for all the previous help. It is really not easy to convert current C/C++ codes into the new C# as it is more than...
11
8748
by: JJLaRocque | last post by:
Hi all, Is there a simple python function to return the list index of the minimum entry in a list of lists? ie, for , , ] to return 2,4. Or, same question but just for a list of numbers, not a list of lists. Thanks, Josh
2
3368
by: Pugi! | last post by:
hi, I am using this code for checking wether a value (form input) is an integer and wether it is smaller than a given maximum and greater then a given minimum value: function checkInteger(&$value, $checks) { $err = ''; if (!is_numeric($value) || (floatval($value) != intval($value))) { $err .= 'Input must be an integer. ';
1
1610
by: truedecembr | last post by:
Hi everyone, I am brand new to Java and not really even sure what I'm doing... I'm supposed to be writing a Timer class that is part of a stop watch application, and it seems to me that the program is correct, but when I run the tester, it is obviously not. The goal is to enter a base and a time, and find time % base, then tell how many times it...
13
2716
by: Ioannis Vranos | last post by:
Is there any mentioning in the standard of the number of bits of the various built in types, apart from char/signed char/unsigned char types? Or only about the minimum value ranges of them?
0
7367
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7291
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7651
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5227
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4855
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1764
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
934
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.