Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Aircraft::get_wall_time_us() to use monotonic clock on non-Windows #13604

Closed

Conversation

m-sasha
Copy link
Contributor

@m-sasha m-sasha commented Feb 18, 2020

This fixes Clock drift when running ArduPilot SITL in a Docker container on a Mac
The bug is that get_wall_time_us uses gettimeofday, which is not guaranteed to be monotonic.
The fix is to use clock_gettime(CLOCK_MONOTONIC, ...) instead.

Should I perhaps also rename get_wall_time_us to get_system_time_us, as it doesn't actually return wall-clock time (and hasn't returned it on Windows even before this PR)?

@tridge
Copy link
Contributor

tridge commented May 10, 2020

this looks like a good change, thanks, just need to ensure it passes CI

@tridge
Copy link
Contributor

tridge commented May 10, 2020

btw, the commit message should start with "SITL: ", per our style guide

@m-sasha
Copy link
Contributor Author

m-sasha commented May 24, 2020

It failed in travis-ci, but it seems the failure wasn't related to my commit:

clang: fatal error: unknown argument: '-mno-thumb-interwork'

@peterbarker
Copy link
Contributor

@m-sasha did you mean to PR this against the Copter stable branch?

Looks like CI is kinda broken there; trying to use a non-cross-compiling clang++ to compile for fmuv3 is ... unintended?

@m-sasha
Copy link
Contributor Author

m-sasha commented May 26, 2020

I'm not sure which branch it should be merged it into, to be honest. Feel free to choose the right one :-)

@tridge tridge changed the base branch from Copter-4.0 to master June 2, 2020 00:21
@tridge tridge changed the base branch from master to Copter-4.0 June 2, 2020 00:22
@tridge
Copy link
Contributor

tridge commented Jun 2, 2020

closing and replaced by #14487

@tridge tridge closed this Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants