SLEEPENH(1) | User commands | SLEEPENH(1) |
sleepenh - an enhanced sleep program
sleepenh [[--warp|-w] INITIALTIME] TIMETOSLEEP
sleepenh is a program that can be used when there is a need
to execute some functions periodically in a shell script. It was not
designed to be accurate for a single sleep, but to be accurate in a sequence
of consecutive sleeps.
After a successful execution, it returns to stdout the timestamp it finished
running, that can be used as INITIALTIME to a successive execution of
sleepenh.
TIMETOSLEEP is a real number in seconds, with microseconds
resolution (1 minute, 20 seconds and 123456 microseconds would be
80.123456).
INITIALTIME is a real number in seconds, with microseconds resolution.
This number is system dependent. In GNU/Linux systems, it is the number of
seconds since midnight 1970-01-01 GMT. Do not try to get a good value of
INITIALTIME. Use the value supplied by a previous execution of
sleepenh.
If you don't specify INITIALTIME, it is assumed the current time.
An exit status greater or equal to 10 means failure. Known exit status:
Suppose you need to send the char 'A' to the serial port ttyS0 every 4 seconds. This will do that:
# just print a nice message on screen
echo -n "I sent 'A' to ttyS0, time now is ";
sleepenh 0;
# wait the required time
TIMESTAMP=$(sleepenh $TIMESTAMP 4.0);
done
This program can be used to get the current time. Just execute:
It is not accurate for a single sleep. Short TIMETOSLEEPs will also not be accurate.
This manual page was written by Pedro Zorzenon Neto.
November 2014 | sleepenh |