Hello. I am developing using de FRDMKE02 and using the CW Sevelopment Studio. In my project, I have defined the following structure for dealing with time:
typedef struct TimeStruct {
unsigned char SECONDS;
unsigned char MINUTES;
unsigned char HOURS;
unsigned char DAY_OF_THE_WEEK;
unsigned char DATE;
unsigned char MONTH;
unsigned char YEAR;
};
I have done a fuction in which I want to add a determined quantity of time (days, hours and minutes; defined by char add_dd, char add_hh and char add_mm respectively) to the entrant TimeStruct and then it should return the resulting TimeStruct. The problem is that I can't even build this fuction.
The error log says that: "return type is an incomplete type".
I hope someone can help me. Regards, Juan Ignacio Troisi
The intended function is:
struct TimeStuct sumar_horas_y_minutos(struct TimeStruct TIEMPO_SUMADO,char add_dd,char add_hh,char add_mm){
TIEMPO_SUMADO.MINUTES = TIEMPO_SUMADO.MINUTES + add_mm;
if(TIEMPO_SUMADO.MINUTES > 59){
TIEMPO_SUMADO.HOURS ++;
TIEMPO_SUMADO.MINUTES = TIEMPO_SUMADO.MINUTES - 60;
}
TIEMPO_SUMADO.HOURS = TIEMPO_SUMADO.HOURS + add_hh;
if(TIEMPO_SUMADO.HOURS >= 24){
TIEMPO_SUMADO.DATE ++;
TIEMPO_SUMADO.HOURS = TIEMPO_SUMADO.HOURS - 24;
}
TIEMPO_SUMADO.DATE = TIEMPO_SUMADO.DATE + add_dd;
switch_month(TIEMPO_SUMADO);
if(TIEMPO_SUMADO.MONTH > 12){
TIEMPO_SUMADO.YEAR ++;
TIEMPO_SUMADO.MONTH = TIEMPO_SUMADO.MONTH -12;
}
return TIEMPO_SUMADO;
}