Getting system time in C/C++

__TIME__ macro is used to print system time in C/C++ language. This macro expands to a string constant that describes the time at which the preprocessor is being run. The string constant contains eight characters and looks like “23:59:01”.

Example :

#include <stdio.h>
int main()
{
    printf("%s",__TIME__);
    getchar();
    return 0;
}