Is there a C runtime equivalent to the Win32 sleep function?

Discussion in 'C Programming' started by Angus Comber, Oct 8, 2005.

  1. Angus Comber

    Angus Comber Guest

    Hello

    I am testing and think I have a timing issue. On Windows I used sleep
    function to wait a while. Is there a C Runtime equivalent?

    I need to port some code to Linux.

    Angus
     
    Angus Comber, Oct 8, 2005
    #1
    1. Advertising

  2. Angus Comber

    Skarmander Guest

    Angus Comber wrote:
    > I am testing and think I have a timing issue. On Windows I used sleep
    > function to wait a while. Is there a C Runtime equivalent?
    >

    No.

    See 19.37 of the FAQ: http://www.eskimo.com/~scs/C-faq/q19.37.html,
    which gives some approximations that may still be of use.

    S.
     
    Skarmander, Oct 8, 2005
    #2
    1. Advertising

  3. Angus Comber

    SM Ryan Guest

    "Angus Comber" <> wrote:
    # Hello
    #
    # I am testing and think I have a timing issue. On Windows I used sleep
    # function to wait a while. Is there a C Runtime equivalent?
    #
    # I need to port some code to Linux.

    sleep(), alarm(), and various other timing operations.

    --
    SM Ryan http://www.rawbw.com/~wyrmwif/
    Quit killing people. That's high profile.
     
    SM Ryan, Oct 8, 2005
    #3
  4. Angus Comber

    Chris Hills Guest

    In article <di8f2d$10b$1$>, Angus Comber
    <> writes
    >Hello
    >
    >I am testing and think I have a timing issue. On Windows I used sleep
    >function to wait a while. Is there a C Runtime equivalent?
    >
    >I need to port some code to Linux.
    >

    You mean is there a linux equivalent?


    --
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
    /\/\/ www.phaedsys.org \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
     
    Chris Hills, Oct 8, 2005
    #4
  5. SM Ryan <> writes:
    > "Angus Comber" <> wrote:
    > > Hello
    > >
    > > I am testing and think I have a timing issue. On Windows I used sleep
    > > function to wait a while. Is there a C Runtime equivalent?
    > >
    > > I need to port some code to Linux.


    [ Obnoxious '#' quoting character corrected yet again. ]

    > sleep(), alarm(), and various other timing operations.


    Standard C does not have sleep() or alarm().

    <OT>
    Linux does. For more details, consult your documentation. If that
    fails, try Google. If that fails, try comp.unix.programmer (Linux is
    close enough to Unix in this area).
    </OT>

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
     
    Keith Thompson, Oct 8, 2005
    #5
  6. Angus Comber

    Guest

    in linux you can use sleep() ou usleep() (nanoseconds i think)
     
    , Oct 12, 2005
    #6
  7. writes:
    > in linux you can use sleep() ou usleep() (nanoseconds i think)


    And this is why we discourage off-topic answers in this newsgroup.
    There's an error in the above answer, but since it's system-specific
    this isn't the place to go into the details. (Fortunately, it's easy
    enough to read the documentation for the relevant functions.)

    There is no standard C equivalent to sleep(); you have to use a
    system-specific function. This was already mentioned here several
    days ago, so I don't know you're adding to the discussion.

    Finally, *please* learn how to post properly using Google Groups.
    Don't assume your readers can see the parent article (in fact, it's
    expired on my server).

    If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers.

    And please complain to Google about their broken interface. Perhaps
    if they get enough complaints from their users, they'll fix it.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
     
    Keith Thompson, Oct 12, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gonzalo Moreno
    Replies:
    2
    Views:
    12,576
  2. rbt
    Replies:
    2
    Views:
    363
    Steve Horsley
    Sep 22, 2005
  3. Sam Roberts
    Replies:
    16
    Views:
    410
    Daniel Berger
    Feb 18, 2005
  4. Richard
    Replies:
    7
    Views:
    263
    Richard
    May 22, 2007
  5. K Balusu
    Replies:
    3
    Views:
    106
    Lasse Reichstein Nielsen
    Oct 6, 2003
Loading...

Share This Page