unittests for rtems working

This commit is contained in:
2023-01-19 14:24:33 +01:00
parent fdfdce2fb0
commit adb8483bb0
5 changed files with 77 additions and 29 deletions

View File

@ -107,9 +107,6 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
rtems_status_code status = rtems_clock_get_tod(&timeRtems);
switch (status) {
case RTEMS_SUCCESSFUL: {
/* The last field now contains the RTEMS ticks of the seconds from 0
to rtems_clock_get_ticks_per_second() minus one.
We calculate the microseconds accordingly */
time->day = timeRtems.day;
time->hour = timeRtems.hour;
time->minute = timeRtems.minute;
@ -140,7 +137,7 @@ ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval*
timeRtems.hour = from->hour;
timeRtems.minute = from->minute;
timeRtems.second = from->second;
timeRtems.ticks = from->usecond * getTicksPerSecond() / 1e6;
timeRtems.ticks = from->usecond * rtems_clock_get_ticks_per_second() / 1e6;
to->tv_sec = _TOD_To_seconds(&timeRtems);
to->tv_usec = from->usecond;
return returnvalue::OK;