Update package 2 #22
@ -157,8 +157,8 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to,
|
||||
if (length < 19) {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
// Newlib nano can't parse uint8, see SCNu8 documentation and https://sourceware.org/newlib/README
|
||||
// Suggestion: use uint16 all the time. This should work on all systems.
|
||||
// Newlib nano can't parse uint8, see SCNu8 documentation and https://sourceware.org/newlib/README
|
||||
// Suggestion: use uint16 all the time. This should work on all systems.
|
||||
#if FSFW_NO_C99_IO == 1
|
||||
uint16_t year;
|
||||
uint16_t month;
|
||||
@ -200,8 +200,8 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to,
|
||||
to->usecond = (second - floor(second)) * 1000000;
|
||||
return RETURN_OK;
|
||||
}
|
||||
// Warning: Compiler/Linker fails ambiguously if library does not implement
|
||||
// C99 I/O
|
||||
// Warning: Compiler/Linker fails ambiguously if library does not implement
|
||||
// C99 I/O
|
||||
#else
|
||||
uint16_t year;
|
||||
uint8_t month;
|
||||
@ -494,7 +494,7 @@ ReturnValue_t CCSDSTime::checkTimeOfDay(const Clock::TimeOfDay_t* time) {
|
||||
|
||||
ReturnValue_t CCSDSTime::convertTimevalToTimeOfDay(Clock::TimeOfDay_t* to,
|
||||
timeval* from) {
|
||||
//This is rather tricky. Implement only if needed. Also, if so, move to OSAL.
|
||||
//This is rather tricky. Implement only if needed. Also, if so, move to OSAL.
|
||||
return UNSUPPORTED_TIME_FORMAT;
|
||||
}
|
||||
|
||||
@ -502,11 +502,11 @@ ReturnValue_t CCSDSTime::convertFromCDS(timeval* to, const uint8_t* from,
|
||||
size_t* foundLength, size_t maxLength) {
|
||||
uint8_t pField = *from;
|
||||
from++;
|
||||
//Check epoch
|
||||
//Check epoch
|
||||
if (pField & 0b1000) {
|
||||
return NOT_ENOUGH_INFORMATION_FOR_TARGET_FORMAT;
|
||||
}
|
||||
//Check length
|
||||
//Check length
|
||||
uint8_t expectedLength = 7; //Including p-Field.
|
||||
bool extendedDays = pField & 0b100;
|
||||
if (extendedDays) {
|
||||
@ -523,7 +523,7 @@ ReturnValue_t CCSDSTime::convertFromCDS(timeval* to, const uint8_t* from,
|
||||
if (expectedLength > maxLength) {
|
||||
return LENGTH_MISMATCH;
|
||||
}
|
||||
//Check and count days
|
||||
//Check and count days
|
||||
uint32_t days = 0;
|
||||
if (extendedDays) {
|
||||
days = (from[0] << 16) + (from[1] << 8) + from[2];
|
||||
@ -532,7 +532,7 @@ ReturnValue_t CCSDSTime::convertFromCDS(timeval* to, const uint8_t* from,
|
||||
days = (from[0] << 8) + from[1];
|
||||
from += 2;
|
||||
}
|
||||
//Move to POSIX epoch.
|
||||
//Move to POSIX epoch.
|
||||
if (days <= DAYS_CCSDS_TO_UNIX_EPOCH) {
|
||||
return INVALID_TIME_FORMAT;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user