Tom, In my TB monitor kit, I used your Julian date routines, adapted to the 8051 (no variable greater than 32 bits since my compiler does not support them either) to apply the GPS offset correction. It was very helpful.
Didier KO4BB On Wed, Mar 28, 2018, 7:13 AM Tom Van Baak <t...@leapsecond.com> wrote: > Hi Mark, > > > Heather keeps all times as a double precision Julian date. Using > Heather's code can > > be a problem on Arduinos since their "double" precision numbers are > actually 32 bit > > single precision, so you would need to do some more complicated math. > > Ah, more complicated math to solve a problem vs. simpler math to avoid a > problem in the first place. > > Here's a simple "GPS Day Number" example: www.leapsecond.com/tools/gpsdn.c > > To add 1024 weeks to a given date use: > > gpsdn = date_to_gpsdn(year, month, day); > gpsdn += 1024 * 7; > gpsdn_to_ymd(gpsdn, &year, &month, &day); > > That's it. It uses 32 bit integers; no floating point required; works on > any OS, or Arduino. > > /tvb > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. > _______________________________________________ time-nuts mailing list -- time-nuts@febo.com To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.