From: Weiqi Gao Newsgroups: comp.os.msdos.djgpp Subject: Re: __DATE__, __TIME__, and suchlike Date: Sat, 10 Apr 1999 10:36:28 +0000 Organization: CRL Network Services Lines: 29 Message-ID: <370F29AC.70479E27@a.crl.com> References: <7elcoi$hpj$1 AT news7 DOT svr DOT pol DOT co DOT uk> NNTP-Posting-Host: a116006.stl1.as.crl.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.0.34 i586) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Andrew Davidson wrote: > > How do the __DATE__ and __TIME__ defines actually work? I've scoured all the > header files I could lay my hands on but I can't find them anywhere. Are > there any other similar functions? These are ANSI C standard macros whose values are determined at compile time. Compile printf("%s\n", __DATE__); on April 1, 1999, and the executable will print "Apr 1, 1999" (or some such, depending on the locale and the brand of the compier) every time you execute it, even 10 days later. The same thing goes for __TIME__ (and __FILE__, __LINE__, and __STDC__). Try: printf("%s\n", __TIME__); printf("%s\n", __FILE__); printf("%d\n", __LINE__); <-- notice the %d printf("%d\n", __STDC__); <-- notice the %d The __FILE__ and __LINE__ macros are useful in debugging to see the actual execution path. -- Weiqi Gao weiqigao AT a DOT crl DOT com