From: cuz Date: Mon, 23 Sep 2002 21:37:15 +0000 (+0000) Subject: Added the __DATE__ and __TIME__ preprocessor macros X-Git-Tag: V2.12.0~2225 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7215ebd145815650f6e433f1f03f35cfc2720979;p=cc65 Added the __DATE__ and __TIME__ preprocessor macros git-svn-id: svn://svn.cc65.org/cc65/trunk@1403 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/compile.c b/src/cc65/compile.c index de1144bb0..d044a0966 100644 --- a/src/cc65/compile.c +++ b/src/cc65/compile.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 2000-2001 Ullrich von Bassewitz */ +/* (C) 2000-2002 Ullrich von Bassewitz */ /* Wacholderweg 14 */ /* D-70597 Stuttgart */ /* EMail: uz@cc65.org */ @@ -34,9 +34,11 @@ #include +#include /* common */ #include "version.h" +#include "xmalloc.h" /* cc65 */ #include "asmlabel.h" @@ -255,8 +257,10 @@ static void Parse (void) void Compile (const char* FileName) /* Top level compile routine. Will setup things and call the parser. */ { - char* Path; - + char* Path; + char Buf[16]; + time_t Time; + char* TimeStr; /* Add some standard paths to the include search path */ AddIncludePath ("", INC_USER); /* Current directory */ @@ -293,6 +297,14 @@ void Compile (const char* FileName) } } + /* __TIME__ and __DATE__ macros */ + Time = time (0); + TimeStr = ctime (&Time); + sprintf (Buf, "\"%.10s\"", TimeStr); + DefineTextMacro ("__DATE__", Buf); + sprintf (Buf, "\"%.15s\"", TimeStr+11); + DefineTextMacro ("__TIME__", Buf); + /* Initialize the literal pool */ InitLiteralPool ();