[Toybox] Would someone please explain what bash is doing here?

Rob Landley rob at landley.net
Sat May 30 03:03:24 PDT 2020

On 5/29/20 1:10 PM, Chet Ramey wrote:
> On 5/29/20 2:09 PM, Chet Ramey wrote:
>>>> Bash-5.1 will change the way it does $SECONDS to use gettimeofday(), btw.
>>> Meanwhile, I'm fielding:
>>> https://github.com/landley/toybox/pull/210
>> Ironically, gettimeofday() is more portable.
> Whoops, I sent that too early:
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html#tag_16_222

I have no idea what the point of microseconds is. Milliseconds is human
reaction/perception granularity, nanoseconds is hardware resolution, and
microseconds is gratuitously between the two of while serving neither use case.


P.S. Yeah a 5ghz is technically 200 picoseconds but nanoseconds are jittery as
heck anyway, and I say that as someone who worked on a new GPS implementation
and our thermally stabilized reference clock sitting on a tiny electric heater
under an inch of insulating foam would lose six nanoseconds because somebody
opened the door on the other side of the room and the imperceptible breeze
cooled it ever so slightly down.

P.P.S. The thing is, nobody makes gigahertz clock crystals so you take a ~30
megaherz clock crystal and multiply it up with a series of phase locked loops,
and that means the "plus or minus 2 clock cycles" accuracy on your crystal
across its operating thermal range turns into "plus or minus 200" across the
same temperature range, and the fix isn't to find an exotic crystal from
metebelius 3 but to put your quartz fleck in a BIG METAL BOX the size of a
toaster that plugs into wall current and costs thousands of dollars used on ebay
all to keep the temperature and input current and such rock steady, and even
then it takes 24 hours of constant operation to properly stabilize, and what WE
had was a 60 cent part and some packing foam and a lot of software. And what the
NEW version has that the old one didn't is a &#(%&#* temperature sensor so we
can at least _guess_ how it's lying to us.

More information about the Toybox mailing list