Tick Procedure

Returns the number of milliseconds since Windows was started up to 49.71 days.

Syntax

[ dwTime = ] Tick ( )

The Tick procedure syntax has the following parts:

 

Name

Type

Description

dwTime

DWord

Time in milliseconds

Comments

The procedure is accurate to 1ms and can be used to calculate elapsed time between events.

Note that the return DWord value wraps around to 0 every 2^32 milliseconds, which is about 49.71 days. To calculate time difference for large amount of time for 1 second accuracy you can use the Time() function. See the DateTime Data Type topic for more information.

Example

 

The following example iterates 2 seconds: Since the Tick() value can overflow between two calls  (49 days since the system was started) use the following code to calculate time difference that is less than 49.71 days: 

 

DDWord : ddwStartTick 

DDWord : ddwTick 

 

ddwStartTick=Tick() 

repeat   

! do something ...   

...   

 

! prevent from Tick() overflow

ddwTick=Tick()   

if ddwTick<ddwStartTick       

ddwTick=ddwTick+0x100000000    

endif 

until (ddwTick-ddwStartTime) > 2000 

 

See Also

Delay, SDate, STime, Time, Now, MillSecond