This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

trying to use time.h

Other Parts Discussed in Thread: TMS320C6424

Hi all,

I try to use time() and difftime() functions with tms320C6424 but I don't have good result... what i'm doing:

#include "time.h"

time_t result1,result2;

while(1){
    time(&result1);
    Wait(2);               // own sleep function
    time(&result2);
    nb_sec=difftime(result2,result);
    Printf(UART1,"%s : %u secs \r\n", asctime(localtime(&result2)),nb_sec);
  }

if i do this, I reach the maximum date (year 2032) in 6 seconds...
changing the CLOCKS_PER_SEC constant has no effect ( i tried with 20,2000, 200 000 000, 20 000 000 000 value)

But if I divide result1 by 200 000 000, it prints the right time only once. Result variable seems to diverges very quickly. I think i didn't initialise something, but what? and how?

 

Thanks in advance,

Florian