Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link date and time 1

Status
Not open for further replies.

lupien1

Programmer
Mar 1, 2005
34
0
0
CA
Hi,

I would like to put dynamicaly, has information in my about dialog box, the date and the time when the link of the program has been done. How can i do this???

Thank you

 
If the link is done at the same time as a compile you could maybe use the [tt]__DATE__[/tt] and [tt]__TIME__[/tt] macros.
Code:
#include <stdio.h>

static const char Date[] = __DATE__;
static const char Time[] = __TIME__;

int main(void)
{
   printf("Built on %s at %s\n", Date, Time);
   return 0;
}

/* my output
Built on Apr 26 2005 at 11:48:52
*/
 
You can use the above approach even if the link is done at a different time than the compile.

Just make a tiny C source file containing only the [tt]Date[/tt] and [tt]Time[/tt] symbols in the example above. Make sure this file gets compiled whenever you link the rest of your project.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top