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.

TMS320F28377D: issue about getting the current time

Part Number: TMS320F28377D


Hi Team,

Why is the time obtained with __DATE__ and __TIME__ not the current compiled version time, but the date of the first compilation?

--

Thanks & Regards

Yale

  • The time and date given by those predefined macros is the current date and time.  Here is one way to see it ...

    C:\examples>type file.c
    char *test()
    {
       return __TIME__;
    }
    
    C:\examples>cl2000 --gen_preprocessor_listing file.c
    
    C:\examples>type file.rl
    L 1 "file.c"
    Nchar *test()
    N{
    N   return __TIME__;
    X   return "09:39:30";
    N}
    
    C:\examples>cl2000 --gen_preprocessor_listing file.c
    
    C:\examples>type file.rl
    L 1 "file.c"
    Nchar *test()
    N{
    N   return __TIME__;
    X   return "09:39:36";
    N}

    This example shows the source code to a simple test function that uses __TIME__.  Then it builds it with the option --gen_preprocessor_listing.  To learn more about this option, please search for it in the C28x compiler manual.  The important details are that it creates file.rl, lines of normal source start with N, and lines with X are what is present after expanding macros like __TIME__.  The example is built twice.  You can see that they are built 6 seconds apart.  This demonstrates that __TIME__ changes as the compile time changes.  

    If you see different behavior, please demonstrate it in a similar manner.

    Thanks and regards,

    -George