Converting TimeUs

Hello,

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?

Anybody know how to do this?

TimeUs contains the number of uSeconds since system boot. As I saw, ctime smallest unit is milliseconds, this is why you get strange numbers.

But keep in mind, TimeUS is not a date/time but ellapsed time since boot.

If I look at the different matrices, for instance BAT has a column with TimeUS, but GPS also has it’s own column with TimeUS which is different to the BAT TimeUS.
If I want to plot two curves, how do I use the same time stamp?

the TimeUS column is always equals or larger then the line before.
So if you look at the whole log, it gives you a time reference.

I’m not well versed in MathLab, so i cannot tell how to make use of TimeMS. But this could help > https://github.com/AndersonRayner/APM_Analysis_MATLAB

Thank you for your help.

Unfortunately I don’t see how it works.
If you check the attached picture you can see that the column in BAT is different than the column in GPS (both are the second columns and both from the same log file).
I would assume that I could use these to plot their values, but the time stamps are really different so I don’t know when one event happened relative to the other.

look at the combined times from the first two lines of your tables
image
Logging does not happen at the same time, even some values are logged more frequently than others,(in your case BAT logged twice as many times than GPS) but the uS value sets a common time reference. I think you can go with a 100mS granuality so divide by 100000.

2 Likes

Oh yes, that makes sense.
Thank you very much for clearing that up!