mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 22:03:34 +08:00
Linux clock driver
This commit is contained in:
@@ -3,12 +3,28 @@
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cerrno>
|
||||
#include <uavcan/uavcan.hpp>
|
||||
#include <uavcan_linux/socketcan.hpp>
|
||||
#include <uavcan_linux/clock.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello owl." << std::endl;
|
||||
double sec = 0;
|
||||
std::cout << "Enter system time adjustment in seconds: " << std::endl;
|
||||
std::cin >> sec;
|
||||
|
||||
uavcan_linux::SystemClockDriver clock;
|
||||
|
||||
try
|
||||
{
|
||||
clock.adjustUtc(uavcan::UtcDuration::fromUSec(sec * 1e6));
|
||||
}
|
||||
catch (const uavcan_linux::Exception& ex)
|
||||
{
|
||||
std::cout << ex.what() << std::endl;
|
||||
std::cout << strerror(ex.getErrno()) << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user