is there a way to get better timing resolution. Sleep has 1 second resolution

is there a way to get better timing resolution. Sleep has 1 second resolution

Post by Rickey To » Sat, 21 Feb 1998 04:00:00



Is there a way to get better timing resolution on UNIX OS

Sleep has 1 second resolution. I've heard about using select. Any details


Thanks
Rick

 
 
 

is there a way to get better timing resolution. Sleep has 1 second resolution

Post by Andrew Giert » Sat, 21 Feb 1998 04:00:00


 Rickey> Is there a way to get better timing resolution on UNIX OS
 Rickey> Sleep has 1 second resolution. I've heard about using
 Rickey> select. Any details

See the FAQ.

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
                           or <URL: http://www.whitefang.com/unix/>

 
 
 

is there a way to get better timing resolution. Sleep has 1 second resolution

Post by Rainer Temm » Sat, 21 Feb 1998 04:00:00



> Is there a way to get better timing resolution on UNIX OS

> Sleep has 1 second resolution. I've heard about using select. Any details

It's very easy...

Use select() with NULL-Pointers for rfds,wfds,xfds, and specify the desired
time
in the timeval-structure (last parameter).

Remark: This works in a similar way for poll().

See also: Some systems have the usleep() call.

Regards Rainer

 
 
 

is there a way to get better timing resolution. Sleep has 1 second resolution

Post by Brian McCaule » Sat, 21 Feb 1998 04:00:00



> Sleep has 1 second resolution. I've heard about using select. Any details

Have you considered "man select"?  This is a great way to get details
about using select.

Here's a simple implementation of usleep() using select()

void usleep (unsigned int useconds)
{
  struct timeval delay;

  delay.tv_sec = 0;
  delay.tv_usec = useconds;

  select (0, NULL, NULL, NULL, &delay);

Quote:}

--

 .  _\\__[oo       from       | Phones: +44 121 471 3789 (home)

.  l___\\    /~~) /~~[  /   [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
 # ll  l\\  ~~~~ ~   ~ ~    ~ | http://wcl-l.bham.ac.uk/~bam/

 
 
 

is there a way to get better timing resolution. Sleep has 1 second resolution

Post by Yoav Cohen-Siva » Tue, 24 Feb 1998 04:00:00



> Is there a way to get better timing resolution on UNIX OS

> Sleep has 1 second resolution. I've heard about using select. Any details

        You see? You've asked the question and provided the answer in the same
breath.

        Just do a "man select" and all your questions will be answered ;-)


> Thanks
> Rick

        Yoav
 
 
 

is there a way to get better timing resolution. Sleep has 1 second resolution

Post by fl.. » Sat, 28 Feb 1998 04:00:00


: >
: > Is there a way to get better timing resolution on UNIX OS

How about usleep()?
--

 Ben

"You have your mind on computers, it seems."