[time-nuts] Setting correct date on Trimble Thunderbolt receiver
Tom Van Baak
tvb at LeapSecond.com
Wed Mar 28 07:46:06 EDT 2018
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
More information about the time-nuts
mailing list