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

A

Angus Comber

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
 
S

SM Ryan

# 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.
 
C

Chris Hills

Angus Comber said:
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?
 
K

Keith Thompson

[ 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>
 
K

Keith Thompson

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top