This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Display TIME and DATE

Could some body in this forum advise me with
a simple code on how to diplay DATE and TIME
using printf() statement. I tried cut and paste the one posted here, and it did not
even compile ... whole bunch of syntax errors !!!!


Thanks in advance,



JIMMY

Parents
  • What I do is just have a single file - eg, timestamp.c - in the project which just defines a string containing the date & Time:

    char timestamp[] = __DATE__ __TIME__;
    (note that there's no need for sizeof - the compiler does all that automatically!)

    I set this file to 'Always Build' in the uVision Project.
    make the timestamp symbol public, and anything in your code can display the build date & time whenever it wants.

    You could even include such a variable in each of your source files, to give each one a build timestamp, if you wanted (and if you had ROM space to burn!).

Reply
  • What I do is just have a single file - eg, timestamp.c - in the project which just defines a string containing the date & Time:

    char timestamp[] = __DATE__ __TIME__;
    (note that there's no need for sizeof - the compiler does all that automatically!)

    I set this file to 'Always Build' in the uVision Project.
    make the timestamp symbol public, and anything in your code can display the build date & time whenever it wants.

    You could even include such a variable in each of your source files, to give each one a build timestamp, if you wanted (and if you had ROM space to burn!).

Children