precise alarm()

This is a discussion on precise alarm() within the C Programming forums, part of the General Programming Boards category; Is there a way to create an alarm to be precise by a milisecond. Currently I used alarm(), together with ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    15

    precise alarm()

    Is there a way to create an alarm to be precise by a milisecond. Currently I used alarm(), together with the SIGALRM signal but that's too slow. I then tried with gettimeofday() but the cpu had overhead, using all 100%.

    So is there a way to have something like ualarm() ?

    Greets,
    Luka

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,163
    So is there a way to have something like ualarm() ?
    Did you try? http://www.die.net/doc/linux/man/man3/ualarm.3.html
    If you understand what you're doing, you're not learning anything.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    > Is there a way to create an alarm to be precise by a milisecond
    Depends on your definition of precise.
    All desktop operating systems only specify minimum time for all delays of this kind because there is no way to be precise with all the different sources of interrupts, and the interactions of other tasks in the system.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    15
    itsme86: thanx that should do.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. clarification: behavior of type_info::before
    By Sebastiani in forum C++ Programming
    Replies: 11
    Last Post: 04-04-2008, 06:53 PM
  2. Alarm
    By kky2k in forum C Programming
    Replies: 10
    Last Post: 05-29-2007, 11:58 PM
  3. 2-3 Second delay with alarm()
    By Longie in forum C Programming
    Replies: 11
    Last Post: 06-20-2004, 08:46 PM
  4. Replies: 23
    Last Post: 01-31-2003, 02:13 AM
  5. ANN: The Fourth Contest: Alarm Clock, sign up here
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 59
    Last Post: 08-10-2002, 12:24 AM

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