Hi all,
does anyone know how to generate a millisecond delay in C, compiling
under Linux? I understand the function sleep() will generate a delay
down to a resolution of one second, but I need to be able to refine
this to milliseconds.
Any ideas?
Thanks in advance,
Ben. 8 46271
checkout the select() call - it is often used for such a purpose. or
nanosleep().
Macgyver wrote: Hi all,
does anyone know how to generate a millisecond delay in C, compiling under Linux? I understand the function sleep() will generate a delay down to a resolution of one second, but I need to be able to refine this to milliseconds.
Any ideas?
Thanks in advance,
Ben.
Robert Frunzke <Ro************ **@freenet.de> scribbled the following: checkout the select() call - it is often used for such a purpose. or nanosleep().
Which part of the ISO C standard defines either of these functions?
--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Ice cream sales somehow cause drownings: both happen in summer."
- Antti Voipio & Arto Wikla
"Macgyver" <bh******@dodo. com.au> wrote in message
news:63******** *************** ***@posting.goo gle.com... does anyone know how to generate a millisecond delay in C, compiling under Linux? I understand the function sleep() will generate a delay down to a resolution of one second, but I need to be able to refine this to milliseconds.
There is no way to do so in standard C, the topic of this newsgroup. The
function sleep() is also not part of standard C. The clue is the fact that
the operating system is relevant.
Try asking in comp.unix.progr ammer <OT> or man 2 nanosleep </OT>.
Note that you seem to be asking for a way to achieve your solution ("How do
I use a sledgehammer to crack a walnut?"), not for a solution to your
problem ("How do I crack a walnut?"). This may well mean you don't get the
best end result.
Joona I Palaste wrote: Robert Frunzke <Ro************ **@freenet.de> scribbled the following:
checkout the select() call - it is often used for such a purpose. or nanosleep() .
Which part of the ISO C standard defines either of these functions?
Not the ISO C standard. Maybe Posix?
Alex wrote: Note that you seem to be asking for a way to achieve your solution ("How do I use a sledgehammer to crack a walnut?"), not for a solution to your problem ("How do I crack a walnut?"). This may well mean you don't get the best end result.
He doesnt want to use a sledgehammer (sleep), he wants a finer and
tinyer one (nanosleep) ;)
just kidding,
robert bh******@dodo.c om.au (Macgyver) wrote: Hi all,
does anyone know how to generate a millisecond delay in C, compiling under Linux? I understand the function sleep() will generate a delay down to a resolution of one second, but I need to be able to refine this to milliseconds.
Any ideas?
Take the advice about asking in a different newsgroup, because
there is *far* more to this than meets the eye.
In fact, you shouldn't ask in comp.unix.progr amming because the
discussion you need is specific to Linux, not unix in general,
though they won't throw a hissy fit about it like you get here.
Try comp.os.linux.m isc or better might be
comp.os.linux.d evelopment.apps .
--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) fl***@barrow.co m
Robert Frunzke wrote: Joona I Palaste wrote: Which part of the ISO C standard defines either of these functions?
Not the ISO C standard. Maybe Posix?
1. POSIX isn't C. POSIX is an OS thing that has hooks originally
designed for C.
2. If it isn't ISO C, it's off-topic here. Try comp.programmin g.unix or
some such.
On Wed, 07 Jan 2004 12:08:57 +0100
Robert Frunzke <Ro************ **@freenet.de> wrote: Joona I Palaste wrote: Robert Frunzke <Ro************ **@freenet.de> scribbled the following:
checkout the select() call - it is often used for such a purpose. or nanosleep() .
Which part of the ISO C standard defines either of these functions?
Not the ISO C standard. Maybe Posix?
That was Joonas point. This group is about ISO C, the Posix, Unix and
Linux experts hang out in other groups where answers involving these
functions will get properly reviewed for errors.
--
Flash Gordon
Paid to be a Geek & a Senior Software Developer
Although my email address says spam, it is real and I read it. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: richard |
last post by:
I am trying to do non-delay mode read from cin, i.e.
char ch;
...
while( cin.getch(ch) )
{
...
}
I want getch to return whenever there is a char typed (not wait till
a newline is seen).
|
by: amos_s12 |
last post by:
Hello everybody
Is there a possibility to make a delay between two sql statements,
namely one sql statement is performed, then there is a delay of some
seconds and then rhe next statement is performed.
In sybase database, there is a possibility to do such thing by using
the statement waitfor delay 'hh:mm:dd'
for example:
while(...)
|
by: silveira neto |
last post by:
Using a delay in C, using Linux. gcc-3.3
This program do a boy in a bike runing in the screen. :D
Its cool to see about games and delay in C.
#include<stdio.h>
int branco(int j){
int k;
for (k=0;k<j;k++)
{
printf(" ");
|
by: John |
last post by:
Hi all:
Is there a C function to make a procedure sleep or delay for a few
seconds/minutes on Linux and Sun OS platform?
Thanks
|
by: Yeounkun, Oh |
last post by:
Hello.
Sleep (x) function make a process sleep during x seconds.
but, how to sleep during milliseconds...
Pls. help me.
Thank you. Regards.
| |
by: Rene Grothmann |
last post by:
I have managed to communicate between forms and Java applets. A button
press sends the content of the text area to an applet, a second button
gets some text from the applet and puts it into the textarea.
However, at the start, there is a delay of several seconds, before any
of the buttons react to a click. After the first reaction has happened,
all further clicks work immediately.
Is this meant to be so, or can I speed up the first...
|
by: sriever4u |
last post by:
I am new to ARM linux, i am working on AT91RM9200 board and using ARM linuc C complier.. i want to know how to produce nanosecond delay using software...
|
by: maul581 |
last post by:
I know the delay( ) function of Turbo C and used it in my project. By this function we can give intermediate delay in execution from 1 millisecond to 9999 millisecond.
My main question is "Is it possible to get delay less than 1 millisecond in Turbo C"? If by changin any header file (e.g. dos.h) or by creating my own "delay" function, at any way Can I get delay less than 1 millisecond?
If in C it is not possible than please suggest me any...
|
by: arun thakur |
last post by:
hi all,
how could i get a millisecond resolution timer in linux platform with GPS input of 1 PPS .i want to use this timer for the synchronized the channel switching mechanism in wireless medium.
plz help!
thanx
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |