Reply by Richard Jiang November 2, 20052005-11-02
William C Bonner wrote:
> I'm new to DSP Programming. I've got a dsp system board that I'm not > in complete control of, but am doing a bunch of programming on. I'd > like to know if there is an easy way of enabling the C library function > call to clock()? > > The help file in code composer studio indicates that I'd have to write > my own handler, but I have no idea how I might even begin to support > the back end of that function. > > I am also interested in knowing if it would be possible to support the > time() function call, as it would simplify some of the things I'm doing > significantly. I have found it interesting that even though the call > does not seem to work correctly, it tries to use some offset of 8 hours > from GMT. > > time_t timer; > time(&timer); > fprintf(tx,"\t clock() = %u\r\n",clock()); > fprintf(tx,"\t GMT Time = %s",asctime(gmtime(&timer))); > fprintf(tx,"\t Local Time = %s",asctime(localtime(&timer))); > > clock() = 4177131769 > GMT Time = Wed Nov 24 02:35:04 2032 > Local Time = Tue Nov 23 20:35:04 2032 > > When I am connected via the JTAG emulator, the time() function returns > the correct system time, but the clock function continuosly returns > zero. When I disconnect, the clock() function increases the number it > returns untill it gets to the maximum number I listed above, and the > date goes out to 2032. > > If the clock() function wrapped when it got to the maximum value, it > might do for what I need, but I'm mainly looking for any solution.
Why do you stick to clock() or time() functions? Throw in a CDB, then call CLK_getltime() and/or CLK_gethtime() in a task(not in main()) [RJiang]
Reply by William C Bonner November 2, 20052005-11-02
I'm new to DSP Programming.  I've got a dsp system board that I'm not
in complete control of, but am doing a bunch of programming on.  I'd
like to know if there is an easy way of enabling the C library function
call to clock()?

The help file in code composer studio indicates that I'd have to write
my own handler, but I have no idea how I might even begin to support
the back end of that function.

I am also interested in knowing if it would be possible to support the
time() function call, as it would simplify some of the things I'm doing
significantly.  I have found it interesting that even though the call
does not seem to work correctly, it tries to use some offset of 8 hours
from GMT.

time_t timer;
time(&timer);
fprintf(tx,"\t        clock() = %u\r\n",clock());
fprintf(tx,"\t       GMT Time = %s",asctime(gmtime(&timer)));
fprintf(tx,"\t     Local Time = %s",asctime(localtime(&timer)));

    clock() = 4177131769
   GMT Time = Wed Nov 24 02:35:04 2032
 Local Time = Tue Nov 23 20:35:04 2032

When I am connected via the JTAG emulator, the time() function returns
the correct system time, but the clock function continuosly returns
zero.  When I disconnect, the clock() function increases the number it
returns untill it gets to the maximum number I listed above, and the
date goes out to 2032.

If the clock() function wrapped when it got to the maximum value, it
might do for what I need, but I'm mainly looking for any solution.