[time-nuts] arduino solar clock

Jim Lux jimlux at earthlink.net
Mon Jan 20 00:12:43 UTC 2014


On 1/19/14 3:58 PM, Chris Albertson wrote:
> It is.  Both "double" and "float" are 32-bits.  Arduino uses the GCC AVR
> compiler.
>
> If you care a lot about precision you use integer math and do all your
> calculations in integer units of milli or microseconds.  If you try to keep
> time in "floats" you are working with about four decimal digit
> approximations which might not be good enough.
>
>

however, calculating the rate offset for the equation of time might not 
need double precision.

That is, if you're calculating, say, a ppm offset, rather than the 
actual rate, you may not need that level of precision.

For instance, to gain 30 seconds in a day (the rate right now), the 
clock needs to be running 347.22 ppm faster than nominal.

if I calculate as 347, then I gain 29.98 seconds, if I calculate as 348, 
then I gain 30.0672 seconds over the day.

So 0.02 seconds/day isn't a huge error, just from approximation of the EOT.

Really, what it is is calculating the new 1pps divisor for the timer 
driving ISR, which divides down from the clock rate of the Arduino.




More information about the Time-nuts_lists.febo.com mailing list