RTEMS Clock::getDateAndTime needs conversion from ticks to microseconds. #344

Closed
opened 2021-01-12 15:02:30 +01:00 by gaisser · 2 comments
Owner

RTEMS uses ticks in rtems_time_of_day instead of microseconds. The correct amount of ticks per second must be used to convert here. (rtems_clock_get_ticks_per_second)

ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
	// TIsn't this a bug? Are RTEMS ticks always microseconds?
	rtems_time_of_day* timeRtems = reinterpret_cast<rtems_time_of_day*>(time);
	rtems_status_code status = rtems_clock_get_tod(timeRtems);
	switch (status) {
	case RTEMS_SUCCESSFUL:
		return HasReturnvaluesIF::RETURN_OK;
	case RTEMS_NOT_DEFINED:
		//system date and time is not set
		return HasReturnvaluesIF::RETURN_FAILED;
	case RTEMS_INVALID_ADDRESS:
		//time_buffer is NULL
		return HasReturnvaluesIF::RETURN_FAILED;
	default:
		return HasReturnvaluesIF::RETURN_FAILED;
	}
}
RTEMS uses ticks in rtems_time_of_day instead of microseconds. The correct amount of ticks per second must be used to convert here. (rtems_clock_get_ticks_per_second) ``` c++ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) { // TIsn't this a bug? Are RTEMS ticks always microseconds? rtems_time_of_day* timeRtems = reinterpret_cast<rtems_time_of_day*>(time); rtems_status_code status = rtems_clock_get_tod(timeRtems); switch (status) { case RTEMS_SUCCESSFUL: return HasReturnvaluesIF::RETURN_OK; case RTEMS_NOT_DEFINED: //system date and time is not set return HasReturnvaluesIF::RETURN_FAILED; case RTEMS_INVALID_ADDRESS: //time_buffer is NULL return HasReturnvaluesIF::RETURN_FAILED; default: return HasReturnvaluesIF::RETURN_FAILED; } } ```
gaisser added the
bug
label 2021-01-12 15:02:30 +01:00
gaisser changed title from RTEMS Clock::getDateAndTime needs conversion from tics to microseconds. to RTEMS Clock::getDateAndTime needs conversion from ticks to microseconds. 2021-01-12 15:03:56 +01:00
Owner

This will be fixed with the next updates, I implemented a conversion dependant on the system ticks per second.

This will be fixed with the next updates, I implemented a conversion dependant on the system ticks per second.
Author
Owner

Fixed in #363

Fixed in #363
gaisser added this to the ASTP 1.0.0 Local pools milestone 2021-02-09 14:18:51 +01:00
Sign in to join this conversation.
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: fsfw/fsfw#344
No description provided.