The version of `sleep` I was using on a particular ARM device didn't have fractional second support.
I could have sworn that I had tried fractional seconds in Ubuntu before and it didn't work... but it seems to work now. AJ ONeal On Wed, Jan 26, 2011 at 11:58 AM, Jan L. Peterson <[email protected]> wrote: > On Jan 26, 2011, at 11:22 AM, AJ ONeal wrote: >> I don't know about y'all, but I often find cases where I wish I had msleep >> in bash. > > Just curious... what are some cases where you need this functionality? > Precision timing would be hard to do in a shell script due to the startup > overhead of your program, but I can see times when pauses on the order of a > half- or quarter-second could be useful. > > Interestingly enough, sleep(1) on my Mac says it accepts a fractional value > (i.e. sleep 0.5). The man page on my Ubuntu system doesn't mention this, but > it still seems to work: > > linux_bash$ date +%s.%N; sleep 0.5; date +%s.%N > 1296067377.322561535 > 1296067377.825704857 > > Sadly, the date command on the Mac doesn't understand %N, so I have to fake > it with perl: > darwin_bash$ alias hrtime="perl -e 'use Time::HiRes qw(time); print time, > \"\n\";'" > darwin_bash$ hrtime; sleep 0.5; hrtime > 1296068112.03389 > 1296068112.55211 > > Looks like the overhead is acceptable for sleeps longer than 1/100 of a > second or so, on modern hardware, at least. > > -jan- > -- > Jan L. Peterson > http://www.peterson-tech.com/~jlp/ > > -------------------- > BYU Unix Users Group > http://uug.byu.edu/ > > The opinions expressed in this message are the responsibility of their > author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. > ___________________________________________________________________ > List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list > -------------------- BYU Unix Users Group http://uug.byu.edu/ The opinions expressed in this message are the responsibility of their author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. ___________________________________________________________________ List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list
