__TIME__

__TIME__
__TIME__ is a preprocessor macro that expands to current time (at compile time) in the form hh::mm::ss in 24 hour time (e.g. "22:29:12"), as a string. The __TIME__ macro can be used to provide information about the particular moment a binary was built.
void printBuildTime ()
{
    cout << __TIME__ << endl;
}
You can also use the __DATE__ macro to get the current date.

Related

C preprocessor tutorial