Timing in Windows

This is a discussion on Timing in Windows within the Windows Programming forums, part of the Platform Specific Boards category; I have written C++ programs in DOS that use delay to provide millisecond timing accuracy with good results. I am ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    1

    Timing in Windows

    I have written C++ programs in DOS that use delay to provide millisecond timing accuracy with good results. I am now trying to write for the Windows environment, and I have been unable to find anything that will permit me to time events in the millisecond range. I understand that there are problems with accurate timing in the Windows multi-tasking environment, but I have used software that achieves accurate timing. How is it done? Borland C++Builder help and a variety of books appear to be silent on the issue.

    Thank you,
    Milton Steinberg
    Marymount College, Tarrytown NY

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    GetSystemTime() for example, will work at millisecond accuracy.

    >>> are problems with accurate timing in the Windows multi-tasking environment,

    That is not a Windows specific problem, consider, a task issues a "get time" request, (any OS), which succeeds, but then gets swapped out for another task, it then gets swapped back and the last value retrieved, which is now wrong, is returned to the application.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    QueryPerformanceFrequency and QueryPerformanceCounter
    are suppose to be precise.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,655
    Hmm, the C clock() function should still work for you - no?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Anyone using Windows 7?
    By Sharke in forum General Discussions
    Replies: 60
    Last Post: 07-12-2009, 08:05 AM
  2. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 07:14 AM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21