1
0
forked from fsfw/fsfw

linux update

This commit is contained in:
2020-12-14 21:46:33 +01:00
parent e06b15cb9c
commit 336b43572f
11 changed files with 32 additions and 24 deletions

View File

@ -76,25 +76,25 @@ timeval Clock::getUptime() {
ReturnValue_t Clock::getUptime(timeval* uptime) {
//TODO This is not posix compatible and delivers only seconds precision
// is the OS not called Linux?
//Linux specific file read but more precise
// Linux specific file read but more precise.
double uptimeSeconds;
if(std::ifstream("/proc/uptime",std::ios::in) >> uptimeSeconds){
uptime->tv_sec = uptimeSeconds;
uptime->tv_usec = uptimeSeconds *(double) 1e6 - (uptime->tv_sec *1e6);
}
return HasReturnvaluesIF::RETURN_OK;
}
//TODO This is not posix compatible and delivers only seconds precision
// I suggest this is moved into another clock function which will
// deliver second precision later.
// Wait for new FSFW Clock function delivering seconds uptime.
//uint32_t Clock::getUptimeSeconds() {
// //TODO This is not posix compatible and delivers only seconds precision
// struct sysinfo sysInfo;
// int result = sysinfo(&sysInfo);
// if(result != 0){
// return HasReturnvaluesIF::RETURN_FAILED;
// }
// return sysInfo.uptime;
return HasReturnvaluesIF::RETURN_OK;
}
//}
ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
timeval uptime;