Thread: How do I create an accurate timer?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    3

    Question How do I create an accurate timer?

    I am quite new at this C programming.

    I would like to know how do I create the timer clock??

    For ex. If I activate it, it will not do anything for 10 seconds, then after the time runs out, it will move on to the next code.

    This timer is NOT visible, but accurately waits for (for example) 10 seconds (time can be changed later on) and then it does what ever is next.

    I know loops are involved, but how do i make the accurate timing?
    Last edited by Quin; 01-06-2002 at 12:32 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > but accurately waits for (for example) 10 seconds
    If your operating system is multi-tasking, you will never achieve this.

    sleep for instance guarantees that the minimum time will be 10 seconds, the actual delay could be a little longer if the OS had something important to do at that moment.

    You should start by looking for these functions
    sleep
    delay
    Sleep

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to build a timer that counts the seconds elapsed?
    By Nazgulled in forum C Programming
    Replies: 17
    Last Post: 05-28-2007, 12:26 PM
  2. need help making a dot bounce up and down y axis in this prog
    By redwing26 in forum Game Programming
    Replies: 10
    Last Post: 08-05-2006, 12:48 PM
  3. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  4. How to create a file association program?
    By eShain in forum Windows Programming
    Replies: 1
    Last Post: 03-06-2006, 12:15 PM
  5. Timer without sleep();
    By Longie in forum Linux Programming
    Replies: 2
    Last Post: 11-06-2002, 12:39 AM