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.

C2000 Time functions (CCS6.1 Compiler Version 15.9.0 STS)

Hello all,

The Standard time_t datatype is 32 bit and it will have an overflow in 203x...

Is it possible to change the epoche vom 1900 to 1970?

Or can I use the 64 bit implementation of the time functions?

In both cases i don't know how to do this (must i recompile the the rts2800_fpu32.lib? I don't know)

Thanks in advance

Andy.

  • As a matter of fact, 15.9.0.STS supports a new implementation of time_t. If you define the macro __TI_TIME_USES_64 and recompile all of your source files that include <time.h>, you'll get a signed 64-bit time_t with epoch 1970, conforming to the POSIX epoch. You do not need to recompile the library. Keep in mind that this time_t is completely incompatible with the old time_t. Also be aware that older versions of CCS don't support the CIO system call to get the 64-bit time from the host.

    This optional 64-bit time_t is not yet available for all TI targets, but will be in the next major release for all targets.
  • Thank you for quick Response.

    But I have further questions.:

    Is ist also possible to use epoch 1970 with the 32 bit time functions? This is the better way for me because of the compatibility.

    Where is the best place to define the macro? Before I include the time.h or in the C2000 Compiler->Advanced Options->Predefined Symbols?

    Thanks in Advance

    Andy
  • There is no built-in support for using the POSIX epoch 1970 with 32-bit time_t. If you want this, you'll have to modify the source code of the RTS yourself and recompile. Be careful, this is surprisingly complicated. Don't forget mktime and related functions.

    You might be better off declaring a new 32-bit type, old_time_t, and copying to and from this type when you need to store the 64-bit time as 32 bits. The 64-bit time_t is just the plain integer number of seconds since 1970.

    You need to define the macro sometime before you include time.h; either method you suggest will work.
  • sorry that I report so late, but I had problems with CCS6 and the Signum elmulator.

    I will implement it with the suggested solution old_time_t.

    Thank you very much for your help.

    Since I have always problems with the Signum emulator drivers when a new ccs is released, I want to buy an new emulator. Which emulator would you recommend. The emulator should work with an isolated 14-pin header.

  • AWG said:
    Which emulator would you recommend

    We compiler experts lack the expertise to answer.  Please start a new thread in the CCS forum.

    Thanks and regards,

    -George