timers

This is a discussion on timers within the C Programming forums, part of the General Programming Boards category; Does anyone know of a way to use a timer in C; I mean make code execute, not at a ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    4

    timers

    Does anyone know of a way to use a timer in C; I mean make code execute, not at a specific time, but at certain intervals (such as so many seconds apart).

    Thank You

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    _sleep() - <stdlib.h>

    or

    Sleep() - <windows.h>

  3. #3
    Unregistered
    Guest
    You can use sleep() from <stdlib.h>, or alarm() from <unistd.h> (on a POSIX system).

  4. #4
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    for more precise delays you could also use interrupts or timed loops.
    hasafraggin shizigishin oppashigger...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. timers in c
    By steve1_rm in forum C Programming
    Replies: 10
    Last Post: 02-24-2009, 12:34 PM
  2. Threads and Timers
    By scioner in forum C Programming
    Replies: 8
    Last Post: 03-22-2008, 08:56 AM
  3. Timers, Timers, Timers!
    By Stan100 in forum Game Programming
    Replies: 9
    Last Post: 01-24-2003, 04:45 PM
  4. Timers
    By Mox in forum Windows Programming
    Replies: 2
    Last Post: 11-09-2001, 04:34 AM

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