7 years ago.

Compilier time in the program

Is there a macro or pragma in the online compiler to store the compiler date and time in the program so that I can call it when running?

1 Answer

7 years ago.

    Serial pc(USBTX, USBRX);

    pc.printf("Compile date : %s\n", __DATE__);
    pc.printf("Compile time : %s\n", __TIME__);

Accepted Answer

Thanks, that is exactly what I was looking for. But where is this stuff documented. I would rather find it out by myself then asking around.

Uwe

posted by Uwe Haertel 21 Mar 2017

This is pre-define macro feature in compiler, not mbed itself. Most of embedded toolchain (ARMCC, IAR, GNU) support these macros.

https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

posted by Toyomasa Watarai 21 Mar 2017