[time-nuts] GPS seconds conversion on an Arduino
paulswedb at gmail.com
Sun May 14 10:21:07 EDT 2017
I went through much the same thing withe the wwvb cheatn d-psk-r. The date
and time format is integer minutes since 1980 as I recall. Long longs are
Think I used even bigger. But I ended up with leap second tables and leap
It really is complicated. But you learn a lot in the effort. By the way
that was my first serious C program on arduino and it worked. Beyond make
the light blink.
On Sun, May 14, 2017 at 9:25 AM, Ben Hall <kd5byb at gmail.com> wrote:
> On 5/14/2017 5:24 AM, Magnus Danielson wrote:
>> You don't need to boil everything into one single number before
>> decomposing it into another form.
>> If you start with the years, well, the different sums at most offset you
>> by 1 as you branch to the next year at somewhat misaligned dates.
>> Similar with GPS weeks etc.
> Good morning all,
> I tried it by hand last night on two sheets of paper with a calculator and
> a frosty adult beverage...because I'm crazy like that. I'll kill the
> suspense by saying I didn't get the right answer...so the rest of what I'm
> going to say has an error somewhere...but I think I can make the process
> work *if* the time library doesn't hold the answer. (and I think it does)
> I asked <https://www.andrews.edu/~tzs/timeconv/timeconvert.php> to give
> me current GPS time in seconds at known time, and then went to work. That
> same converter has a "tell me GPS seconds now" which agreed with the time
> in seconds coming from the TruePosition.
> So...I figured out how many whole years (37...so its 2017), then used the
> remainder to figure out whole months (4...so its May 2017), the used the
> remainder to figure out days (13...so its 14 May 2017 because any remainder
> puts us into 14 May), then used the remainder to figure out hours (2...so
> its 14 May 2017 02:00), then used the remainder to figure out minutes
> (31...so its 14 May 2017 02:31), then used the remainder to figure out
> seconds (35...so its 14 May 2017 02:31:35), then subtracted 18 leap seconds
> to get 14 May 2017 02:31:17.
> Only problem was that it was 14 May 2017 00:31:17 UTC. I'm not sure why
> the extra two hours...so I clearly got something *wrong*.
> But, I think I should be able to do all this with, at most, single
> precision floating point math. Maybe integers...but I've got to think
> about that as I'm not sure how integer math on the Arduino treats a decimal
> Of course...all this is moot if I can get what I want out of the time
> library. :)
> thanks much,
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to https://www.febo.com/cgi-bin/m
> and follow the instructions there.
More information about the time-nuts