- # get the current time, in ms
- # milliseconds since epoch (1-1-1970)
- now="$(( $( $LOOPSLEEP_DATE +'%s * 1000 + %-N / 1000000' ) ))"
-
- # calculate required sleep in ms
- t=$((t * 1000 * div / 100))
-
- # this is our first run
- # just wait the requested time
- test $LOOPSLEEPMS_LASTRUN -eq 0 && LOOPSLEEPMS_LASTRUN=$now