Pull CFPD bugfix in dev branch #147

Merged
muellerr merged 30 commits from pull-cfdp-fix-into-dev-branch into obsw-v3.0.0-dev 2023-06-09 13:41:29 +02:00
2 changed files with 11 additions and 4 deletions
Showing only changes of commit 1f36c082ef - Show all commits

View File

@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [unreleased]
## Fixes
- Linux OSAL `getUptime` fix: Check validity of `/proc/uptime` file before reading uptime.
# [v6.0.0] 2023-02-10
## Fixes

View File

@ -76,15 +76,18 @@ timeval Clock::getUptime() {
}
ReturnValue_t Clock::getUptime(timeval* uptime) {
// TODO This is not posix compatible and delivers only seconds precision
// Linux specific file read but more precise.
double uptimeSeconds;
if (std::ifstream("/proc/uptime", std::ios::in) >> uptimeSeconds) {
std::ifstream ifile("/proc/uptime");
if (ifile.bad()) {
return returnvalue::FAILED;
}
if (ifile >> uptimeSeconds) {
uptime->tv_sec = uptimeSeconds;
uptime->tv_usec = uptimeSeconds * (double)1e6 - (uptime->tv_sec * 1e6);
}
return returnvalue::OK;
}
return returnvalue::FAILED;
}
// Wait for new FSFW Clock function delivering seconds uptime.
// uint32_t Clock::getUptimeSeconds() {