Skip to content

Commit

Permalink
add GET_TIME
Browse files Browse the repository at this point in the history
  • Loading branch information
bani100 committed Dec 11, 2024
1 parent b25f2c1 commit f12a767
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions a653_lib/a653_i_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* @file a653_i_time.c
* @copyright Airbus Defence and Space
* @author [email protected]
* @date Tue Oct 24 15:53:18 CEST 2023
* @date Wed 11 Dec 2024 04:07:47 AM EST
* @brief a653 timer handling
* @details
*/
Expand All @@ -45,9 +45,11 @@
#include "a653Process.h"


void TIMED_WAIT (SYSTEM_TIME_TYPE DELAY_TIME,
void TIMED_WAIT (SYSTEM_TIME_TYPE DELAY_TIME, /* */
RETURN_CODE_TYPE * RETURN_CODE){
usleep(40000);

/* int usleep(useconds_t usec); */
usleep(DELAY_TIME / 1000);
}

void PERIODIC_WAIT (RETURN_CODE_TYPE * RETURN_CODE){
Expand All @@ -58,10 +60,21 @@ void PERIODIC_WAIT (RETURN_CODE_TYPE * RETURN_CODE){

void GET_TIME (SYSTEM_TIME_TYPE * SYSTEM_TIME,
RETURN_CODE_TYPE * RETURN_CODE){

struct timespec tp;

if (0 == clock_gettime(CLOCK_REALTIME, &tp)){
*SYSTEM_TIME = (tp.tv_sec * 10^9) + tp.tv_nsec;
*RETURN_CODE = NO_ERROR;
} else {
*SYSTEM_TIME = 0;
*RETURN_CODE = NOT_AVAILABLE;
}
}

void REPLENISH (SYSTEM_TIME_TYPE BUDGET_TIME,
RETURN_CODE_TYPE * RETURN_CODE){
printDebug(1,"not implemented yet!!!\n\n");
}


0 comments on commit f12a767

Please sign in to comment.