[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C macro for date
Erez Doron <erez@savan.com> writes:
> HI
>
> does anyone know on how to make a C program print it's compile
> date and time (without writing the date string by hand ever compile) ?
>
> I ask it for gcc BorlandC and djgpp
>
> regards
> erez.
I am looking at "C - A Reference Manual" by Harbison and Steel, 4th
edition, p 295:
"__DATE__ is a string constant representing the date of translation of
the source file in the form 'Mmm dd yyy'"
This is ISO (ANSI) C.
There is an example like
#ifdef __STDC__
printf("Compiled on %s at %s\n",__DATE__,__TIME__);
#endif
Does this help?
--
Oleg Goldshmidt goldshmt@netvision.net.il
BLOOMBERG L.P. (BFM) oleg@bfr.co.il