delay in milliseconds

This is a discussion on delay in milliseconds within the C Programming forums, part of the General Programming Boards category; Hi, I have been using the functions nanosleep and usleep in my project but my compiler cant recognize them even ...

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    7

    delay in milliseconds

    Hi,
    I have been using the functions nanosleep and usleep in my project but my compiler cant recognize them even though I included the library time.h and unistd.h.
    Is there a working function that does it in C?
    btw, im using a linux station.

    Thanks

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    I believe these two functions are posix functions.
    What compiler,OS and error messages?

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    107
    You can try usleep() which is supposed to be in microseconds. It's likely that either 1) you don't have them or 2) you need to link against something.

  4. #4
    Registered User
    Join Date
    Oct 2010
    Posts
    7
    Quote Originally Posted by Bayint Naung View Post
    I believe these two functions are posix functions.
    What compiler,OS and error messages?
    compiler: gcc
    OS: gentoo linux
    error messages: warning: implicit declaration of function 'nanosleep'
    or
    warning: implicit declaration of function 'usleep'

  5. #5
    Registered User
    Join Date
    Oct 2010
    Posts
    107
    Well, if it's implicit declaration, that means you're not actually including the right header for it (otherwise it would have been explicitly defined)

  6. #6
    Registered User
    Join Date
    Oct 2010
    Posts
    7
    well, both time.h and unistd.h are included in my project. any other libraries i need to include?

  7. #7
    Registered User
    Join Date
    Oct 2010
    Posts
    7
    bump?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Regarding delay in the connection
    By byatin in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-19-2008, 02:59 PM
  2. temperature sensors
    By danko in forum C Programming
    Replies: 22
    Last Post: 07-10-2007, 07:26 PM
  3. Networking (queuing delay, avg packet loss)
    By spoon_ in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-05-2005, 11:23 AM
  4. delay code
    By Grayson_Peddie in forum C# Programming
    Replies: 2
    Last Post: 07-15-2003, 11:02 AM

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