Can Unix sleep in terms of mili/micro?

James Cummings james at dlss2.UUCP
Tue Sep 11 22:11:17 AEST 1990


In article <24437 at adm.BRL.MIL> TAYBENGH%NUSDISCS.BITNET at cunyvm.cuny.edu writes:
>
>        Can Unix sleep in terms of mili or mirco second? I am aware that
>sleep() can only sleep in terms of second. Please specify the Unix Dialect
>when u reply. Thanks.

	How 'bout:

main()
{
	sleep_less_than_sec(25);
	exit(0);
}

sleep_less_than_sec(x)
int x;
{
	int i;

	for (i = 0;i <= x;i++)
		;
}

	I'd think that would give you approx. 25 clock cycles, dependent on
the machine, the load on the machine, etc.

-- 
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|Disclaimer:                      | James Cummings                           |
|  You can't blame me!            |   UUCP:                                  |
|  I'm ignorant!                  |    ..swblat!{texbell!texnet..            |
|+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+|              swgate!dlss1..}!dlss2!james |
|Send flames to:                  |   NET:                                   |
|  sowc at devnull.com               |      jc at smunews                          |
|                                 |                                          |
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+



More information about the Comp.unix.internals mailing list