PL PCDU Update Mode Handling #200

Merged
meierj merged 26 commits from mueller/pl-pcdu-update-mode-handling into develop 2022-04-07 11:12:07 +02:00
Showing only changes of commit 0ba2caaf61 - Show all commits

View File

@ -9,6 +9,7 @@
#include <fstream> #include <fstream>
#endif #endif
#include <cmath> #include <cmath>
#include <ctime>
GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId, GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId,
bool debugHyperionGps) bool debugHyperionGps)
@ -172,6 +173,8 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
timeval time = {}; timeval time = {};
time.tv_sec = gpsSet.unixSeconds.value; time.tv_sec = gpsSet.unixSeconds.value;
time.tv_usec = gps->fix.time.tv_nsec / 1000; time.tv_usec = gps->fix.time.tv_nsec / 1000;
// Update the system time here for now. NTP seems to be unable to do so for whatever reason
settimeofday(&time, nullptr);
Clock::TimeOfDay_t timeOfDay = {}; Clock::TimeOfDay_t timeOfDay = {};
Clock::convertTimevalToTimeOfDay(&time, &timeOfDay); Clock::convertTimevalToTimeOfDay(&time, &timeOfDay);
gpsSet.year = timeOfDay.year; gpsSet.year = timeOfDay.year;
@ -192,6 +195,9 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
std::cout << "Longitude: " << gps->fix.longitude << std::endl; std::cout << "Longitude: " << gps->fix.longitude << std::endl;
std::cout << "Altitude(MSL): " << gps->fix.altMSL << std::endl; std::cout << "Altitude(MSL): " << gps->fix.altMSL << std::endl;
std::cout << "Speed(m/s): " << gps->fix.speed << std::endl; std::cout << "Speed(m/s): " << gps->fix.speed << std::endl;
std::time_t t = std::time(nullptr);
std::tm tm = *std::gmtime(&t);
std::cout << "C Time: " << std::put_time(&tm, "%c") << std::endl;
} }
} }
#endif #endif