Skip to content

Commit

Permalink
Fix: make more universally buildable
Browse files Browse the repository at this point in the history
OkapiLib did not build on all systems due to not-officially-supported idioms and by referencing some attributes of high_resolution_clock.
  • Loading branch information
NoRePercussions committed Feb 8, 2023
1 parent 40cd531 commit 5397aa7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/okapi/api/units/RQuantityName.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "okapi/api/units/QLength.hpp"
#include "okapi/api/units/QSpeed.hpp"
#include <stdexcept>
#include <string>
#include <typeindex>
#include <unordered_map>

Expand Down
2 changes: 1 addition & 1 deletion include/test/tests/api/implMocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class MockTimer : public AbstractTimer {

QTime millis() const override;

std::chrono::system_clock::time_point epoch = std::chrono::high_resolution_clock::from_time_t(0);
std::chrono::system_clock::time_point epoch = std::chrono::system_clock::from_time_t(0);
};

/**
Expand Down
4 changes: 3 additions & 1 deletion src/api/chassis/controller/defaultOdomChassisController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ void DefaultOdomChassisController::driveToPoint(const Point &ipoint,
const QLength &ioffset) {
waitForOdomTask();

auto [length, angle] = OdomMath::computeDistanceAndAngleToPoint(
QLength length;
QAngle angle;
std::tie<QLength, QAngle>(length, angle) = OdomMath::computeDistanceAndAngleToPoint(
ipoint.inFT(defaultStateMode), odom->getState(StateMode::FRAME_TRANSFORMATION));

if (ibackwards) {
Expand Down
2 changes: 1 addition & 1 deletion test/implMocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ MockTimer::MockTimer() : AbstractTimer(millis()) {

QTime MockTimer::millis() const {
return std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::high_resolution_clock::now() - epoch)
std::chrono::system_clock::now() - epoch)
.count() *
millisecond;
}
Expand Down

0 comments on commit 5397aa7

Please sign in to comment.