Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripting: sleep < 1 second 2

Status
Not open for further replies.

TSch

Technical User
Jul 12, 2001
557
DE
Hi folks,

i was wondering ...
Is it possible to script a sleeptime less than 1 second under AIX ?

print "Something"
sleep x
print "Something else"

And x shall be let's say 0.5 seconds ...

How can I do this ?

Regards
Thomas
 
No I'm afraid you can't

man sleep

Code:
 The sleep command suspends execution of a process for at least the interval specified by the Seconds parameter. The
       amount of time specified in the Seconds parameter can range from 1 to MAXINT (2,147,483,647) seconds.

Regards,
Khalid
 
Can't be done, unless you compile a program microsleep.c:

Code:
main (int argc, char *argv[])
{
  long usec;

  usec = atol (argv[1]);
  usleep (usec);
}

cc -o microsleep microsleep.c
mv microsleep /usr/local/bin/microsleep

or put it somewhere else you prefer.



HTH,

p5wizard
 
Sounds good :)

I'll try it ...

Thanks a lot.

Regards
Thomas
 
sleep .5 seconds would then be

microsleep 500000

but I guess you figured that out already.


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top