Thread: sleep in milliseconds.

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    3

    Unhappy sleep in milliseconds.

    Hi,
    Iam working on a project in LINUX and i require my program to go into sleep for 100ms or 200ms but sleep() takes only seconds as argumuments. Is there a way?? If there are no inbulit functions is there a way to count in milliseconds??Plz help.
    Also can u tell me wat C functions are used in writing data to the USB ports of linux machines?? Thx in advance.

    Sam.

  2. #2
    Registered User fischerandom's Avatar
    Join Date
    Aug 2005
    Location
    Stockholm
    Posts
    71
    Code:
    usleep( 100000 ); /* Sleep 100000 micro seconds = 100 ms, etc. */
    One link:
    http://www.opengroup.org/onlinepubs/...sh/usleep.html
    Bobby Fischer Live Radio Interviews http://home.att.ne.jp/moon/fischer/

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sleep in milliseconds.
    By nethunter in forum Linux Programming
    Replies: 3
    Last Post: 04-12-2006, 02:29 PM
  2. Sleep works with just one thread, but not 2
    By finkus in forum C++ Programming
    Replies: 5
    Last Post: 12-01-2005, 09:17 PM
  3. Problem with Sleep() #$@^#$%^
    By intruder in forum C++ Programming
    Replies: 8
    Last Post: 10-11-2004, 06:46 AM
  4. why do we require sleep?
    By jinx in forum A Brief History of Cprogramming.com
    Replies: 43
    Last Post: 07-14-2004, 08:21 AM
  5. Sleep is overrated...
    By Polymorphic OOP in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 01-24-2003, 12:40 PM