Microsoft KB Archive/83859

= Microsoft Knowledge Base =

Test TIMER Function Gives Milliseconds Since Windows Started
Last reviewed: October 19, 1994

Article ID: Q83859

The information in this article applies to:

- Microsoft Test for Windows, versions 1.0 and 2.0

SUMMARY
The TIMER function in Microsoft Test uses the Windows API routine GetTickCount, which returns the number of milliseconds since Windows was started. A program example below demonstrates this.

Contrary to the documentation, the TIMER function does NOT return the number of seconds since midnight. Instead, it returns the number of milliseconds since Windows was started.

Example of TIMER Function

 * 1) Start the Test driver.
 * 2) From the Window menu, choose Show Viewport to be able to see the output.
 * 3) Enter the following code:

print &quot;the date and time = &quot;;datetime$

ret& = timer  'return the time in millisecond into a long print ret&    'this will print the time since Windows was last started sleep 3 'wait 3 seconds or more if other Windows processes are running

print &quot;date time 2 = &quot;;datetime$  'print the new time ret& = timer 'get the new timer return value and print it print ret&


 * 1) From the Run menu, choose Start to run the Test script.
 * 2) Click on the Viewport window and note that the timer function is a number in milliseconds. To verify that this is the amount of time since the Windows session was started, save the Test script, exit Windows, and restart. Then run the timer test again, and note that the values returned by the timer function will be much smaller.

Documentation Corrections
The following corrections apply to page 541 of the &quot;Microsoft Test for Windows User's Guide&quot; version 1.0 manual, to page 519 of the &quot;Microsoft Test for Windows User's Guide&quot; version 2.0 manual, and to the online Help (MSTEST.HLP) section for the TIMER function:

  The following description for the TIMER function is incorrect The TIMER function gives the number of seconds (in     hundredths) since midnight. and should be changed to read as follows: The TIMER function gives the number of milliseconds since Windows was started.   Because the TIMER function returns a LONG integer, the following syntax example is incorrect Ret% = TIMER and should be changed to read as follows: Ret& = TIMER 

For a complete list of documentation corrections for Microsoft Test for Windows, query in this knowledge base on the following words:

MSTEST.HLP and README.WRI and Guide and corrections