Click here to Skip to main content
15,562,816 members
Home / Discussions / C#
   

C#

 
GeneralRe: Floating Window Z-Order.... Pin
Niels Penneman14-Jan-04 10:25
Niels Penneman14-Jan-04 10:25 
GeneralRe: Floating Window Z-Order.... Pin
Anders Molin14-Jan-04 10:28
professionalAnders Molin14-Jan-04 10:28 
GeneralRe: Floating Window Z-Order.... Pin
Anders Molin14-Jan-04 10:25
professionalAnders Molin14-Jan-04 10:25 
GeneralRe: Floating Window Z-Order.... Pin
Heath Stewart14-Jan-04 10:19
protectorHeath Stewart14-Jan-04 10:19 
Generaltimer Pin
maria_p14-Jan-04 7:38
maria_p14-Jan-04 7:38 
GeneralRe: timer Pin
Heath Stewart14-Jan-04 9:26
protectorHeath Stewart14-Jan-04 9:26 
GeneralRe: timer Pin
maria_p14-Jan-04 10:54
maria_p14-Jan-04 10:54 
GeneralRe: timer Pin
Heath Stewart14-Jan-04 11:23
protectorHeath Stewart14-Jan-04 11:23 
As far as the resolution of the three timers in the .NET base class library go, the System.Windows.Forms.Timer uses the native SetTimer API, which uses time in milliseconds. System.Timers.Timer uses the native SetWaitableTimer and then uses a WaitableTimer (internal class) which calls SetWaitableTimer. This native function uses ticks - or 100 nanoseconds. Unfortunately, the System.Timers.Timer.Interval property takes time in milliseconds, thus decreasing the resolution. Frown | :( The System.Threading.Timer is mostly managed internally, so we can't know for sure how it works, but the documentation states that the interval is also specified in milliseconds.

So, the resolution of the timers in the .NET base class library is 1 millisecond. If you want to wrap CreateWaitableTimer, SetWaitableTimer, and CancelWaitableTimer in order to use ticks for better resolution, you can. The difference in time may make up for any time spent marshaling parameters. Of course, as long as you stick with the intrinsic types (int, long, double, byte, etc.), the SDK states that no time is spent marshaling since it is unnecessary.

As far as using timers besides those provided by the OS, I'm not really sure what else you'd use besides a timer card[^]. The resolution of a few of those cards isn't any better (some are even measured in seconds!) but you might get more accurate results taking only the hardware into account. Since each will most likely come with a C SDK, you might find yourself worrying about marshaling again.

Since you mentioned in your last post that these are to control robots, I would recommend you find some resources online regarding programming robots to find out how others accomplish that. The only experience I've had is reading a little about programmable robots with their own controller boards (a former-coworker of mine did the work, but I was passively curious at best).

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: timer Pin
maria_p25-Jan-04 9:52
maria_p25-Jan-04 9:52 
GeneralRe: timer Pin
maria_p18-Feb-04 9:53
maria_p18-Feb-04 9:53 
GeneralRe: timer Pin
Heath Stewart18-Feb-04 10:23
protectorHeath Stewart18-Feb-04 10:23 
GeneralOutlook 2003 -( Inbox look-alike) Pin
Nick_Chr14-Jan-04 7:10
Nick_Chr14-Jan-04 7:10 
GeneralRe: Outlook 2003 -( Inbox look-alike) Pin
Heath Stewart14-Jan-04 9:10
protectorHeath Stewart14-Jan-04 9:10 
GeneralRe: Outlook 2003 -( Inbox look-alike) Pin
Nick_Chr14-Jan-04 23:25
Nick_Chr14-Jan-04 23:25 
GeneralGetHashCode vs. Equals Pin
balkanese14-Jan-04 6:31
balkanese14-Jan-04 6:31 
GeneralRe: GetHashCode vs. Equals Pin
scadaguy14-Jan-04 7:26
scadaguy14-Jan-04 7:26 
GeneralRe: GetHashCode vs. Equals Pin
balkanese15-Jan-04 22:46
balkanese15-Jan-04 22:46 
GeneralInternet downloading problem... Pin
profoundwhispers14-Jan-04 5:26
profoundwhispers14-Jan-04 5:26 
GeneralRe: Internet downloading problem... Pin
Heath Stewart14-Jan-04 5:56
protectorHeath Stewart14-Jan-04 5:56 
GeneralRe: Internet downloading problem... Pin
Kentamanos14-Jan-04 7:35
Kentamanos14-Jan-04 7:35 
GeneralRe: Internet downloading problem... Pin
Heath Stewart14-Jan-04 8:45
protectorHeath Stewart14-Jan-04 8:45 
GeneralRe: Internet downloading problem... Pin
Kentamanos14-Jan-04 10:05
Kentamanos14-Jan-04 10:05 
Generalremoting "newbie" questions Pin
Palladino14-Jan-04 3:24
Palladino14-Jan-04 3:24 
GeneralRe: remoting "newbie" questions Pin
LongRange.Shooter14-Jan-04 4:07
LongRange.Shooter14-Jan-04 4:07 
GeneralRe: remoting "newbie" questions Pin
LongRange.Shooter14-Jan-04 4:23
LongRange.Shooter14-Jan-04 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.