GetTickCount

Overview

The GetTickCount() function returns the number of milliseconds that have elapsed since the system started.

Signature

uint GetTickCount();

Return Value

  • Type: uint
  • Description: The number of milliseconds since system start.
  • Constraints and Notes

  • The counter is limited by system timer restrictions.
  • Time is stored as an unsigned integer and will overflow approximately every 49.7 days if the computer runs uninterruptedly.
  • Example

    #define MAX_SIZE 40

    void OnStart() { uint start = GetTickCount(); long fib = 0; for(int i = 0; i < MAX_SIZE; i++) fib = TestFibo(i); uint time = GetTickCount() - start; PrintFormat("Calculating %d first Fibonacci numbers took %d ms", MAX_SIZE, time); return; }

    long TestFibo(long n) { if(n < 2) return(1); return(TestFibo(n - 2) + TestFibo(n - 1)); }

    See Also

  • [Date and Time](/dateandtime)
  • [GetPointer](/common/getpointer)
  • [GetMicrosecondCount](/common/getmicrosecondcount)