[ 原始碼: sleepenh ]
套件:sleepenh(1.7-1)
Sleep until a given date with subsecond resolution
sleepenh is a sleep program for shell scripts that need to perform a loop that repeats at a regular time interval, without cumulative errors.
It supports microsecond resolution.
You can also specify the time you need between two calls of sleepenh.
Here follows an usage example to clarify its purpose. This example sends 'A' to ttyS0 every 1.2 seconds.
#!/bin/sh # does not wait (or wait 0), just to get initial timestamp TIMESTAMP=$(sleepenh 0) while true; do # send the byte to ttyS0 echo -n "A" > /dev/ttyS0; # wait until the required time TIMESTAMP=$(sleepenh $TIMESTAMP 1.200); done
For more details, please read the manpage.