Results 1 to 4 of 4

Thread: GetTickCount

  1. #1

    GetTickCount

    I'm using GetTickCount as a controller for a game framework I'm building. I've setup a logging mechanism for the entire framework so that I can easily track what's going on inside my program and analyse it at my leisure. While working on the timer for the game I've decided to output the results of GetTickCount to my log file and see exactly how fast the code is running. So I did just that but when I analysed my data I noticed something odd. The log tickcount only changes every 3500 entries and when it does it suddenly jumps by about 16 milliseconds. So instead of a smooth flow from 1 millisecond to the next it jumps by 16 milliseconds. I know it's not because of slow code because it logs about 3500 logs all with the same TickCount before it jumps. It would seem that GetTickCount isn't very accurate and is only changing once every 0.016 of a second. Can anyone confirm this?
    Isometric game development blog http://isoenginedev.blogspot.com/

  2. #2

    GetTickCount

    The accuracy of GetTickCount depends on how often windows updates system timer. The resolution can be as low as 50ms.

    Use QueryPerformanceCounter/QueryPerformanceFrequency for accurate timing.

  3. #3

    GetTickCount

    Yes, this is how it works. You can enhance it by using timeBeginPeriod(1); time:= timeGetTime; timeEndPeriod(1); to around 1ms range.

    But it's better to use QueryPerformanceFrequency / QueryPerformanceCounter functions.
    There are only 10 types of people in this world; those who understand binary and those who don't.

  4. #4

    GetTickCount

    There are only 10 types of people in this world; those who understand binary and those who don't.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •