How do I create an accurate timer?

This is a discussion on How do I create an accurate timer? within the C Programming forums, part of the General Programming Boards category; I am quite new at this C programming. I would like to know how do I create the timer clock?? ...

  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-05-2002 at 11:32 PM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    > 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, 05:23 AM
  4. How to create a file association program?
    By eShain in forum Windows Programming
    Replies: 1
    Last Post: 03-06-2006, 11:15 AM
  5. Timer without sleep();
    By Longie in forum Linux Programming
    Replies: 2
    Last Post: 11-05-2002, 11:39 PM

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