# 2.1.25.30 GetTickCount

## Description

Retrieve number of milliseconds elapsed since the system was started

## Syntax

UINT GetTickCount( )

## Return

the number of milliseconds ellapsed since the system was restarted.

## Examples

EX1

// This example measures how much time (in milliseconds) it takes
// to execute an empty for-loop of 1000.
int GetTickCount_ex1()
{
DWORD dw1 = GetTickCount();

for(int ii = 0; ii < 1000; ii++)
;

printf("Empty loop of 1000 takes %d ms\n",GetTickCount()-dw1);
return 1;
}

## Remark

The GetTickCount function retrieves the number of milliseconds that have elapsed since the system was started.

It is limited to the resolution of the system timer.

It is often used to measure time needed to complete an operation (see the example).