About GPS_Time convertion to UTC time

Hello,
I recently figured out how to convert the epoch time from my arduplane data flash logs in matlab. The problem is it looks like I was flying for four days! lol. I know the flight was no longer than 20 minutes. Aafter running the script below I just watch the HH part of the output and I see the hours incrmenting from zero to 24 four times over the flight. I will looking making sure the pixhawk knows the right time I guess.

time_reference = datenum(‘1970’, ‘yyyy’);
time_matlab = (time_reference + GPS_Time)./ 8.64e7;
time_matlab_string = datestr(time_matlab, ‘yyyymmdd HH:MM:SS.FFF’)

You’re welcome to look at the source code in Ardupilog, which uses the GPS to find the UTC time when the plane first booted up. Check out the “findBootTimeUTC” method on line 342 of Ardupilog.m

Thanks for the tip. I will look in there. In more recent news, I took the first and last gps epoch time stamps and put them in an online converter. The first time stamp showed the date being 1976 and the last was 1986.

I am pretty sure I am doing something wrong. All I really want is the change in time between each recorded value in a log file.

Ok, please let us know if you take a look at our code, and think we are also doing it wrong.

Hello,

I also am having issues converting the time.
In mission planner I convert to a Matlab file, in there I use the ctime() command of three consecutive time stamps.
In Mission planner these have a difference of 100ms.
What I get in Matlab for the same three are: Tue May 29 18:02:49 1973, Wed May 30 21:48:51 1973 and Fri Jun 01 01:45:28 1973

Could you explain how to convert the TIMEUS into the correct time shown in Mission Planner?