Partilhar via


Timer

Glossary Item Box

VPL User Guide: Using Services

See Also Microsoft Robotics Developer Studio Send feedback on this topic

Timer

Timer

Timer - Icon

The Timer service supports setting timers, waiting for intervals and getting the current time.

The service provides the following requests.

Request Description
Get Gets the timer’s current state. This includes the current set timeout value (if any) and when it is expected to complete.
GetCurrentTime Returns the current time.
SetTimer Sets the timer (in milliseconds).
Tick Generates a notification every second.
TimerComplete Indicates that a timer interval (using SetTimer) has elapsed.
Wait Wait for the specified interval (in milliseconds).

When you use the Wait request, the Timer service will not send a response until the specified interval has passed.

Dd126875.hs-note(en-us,MSDN.10).gif

The Wait message is intended for short intervals only. For longer intervals use the SetTimer message. An attempt to wait for longer than 60 seconds will fail. In practice the Wait message is only appropriate for much smaller intervals.

To establish a longer timer use the SetTimer request with the desired time interval. After that time has elapsed the Timer service will generate a TimerComplete notification.

The SetTimer request establishes a One-Shot timer. Using SetTimer before the timer completes, supercedes any previous SetTimer request (resets the timer). If you want to create a repeating timer, issue a new SetTimer request whenever a TimerComplete notification arrives.

See also the explanation of services in Using Services which uses the Timer service as an example.

See Also 

VPL User Guide: Using Services

 

 

© 2012 Microsoft Corporation. All Rights Reserved.