From c9456e766f447fff9eec0666a5d0c2dc34288751 Mon Sep 17 00:00:00 2001 From: icemank Date: Mon, 23 Jun 2003 16:25:07 +0000 Subject: [PATCH] Moved setting of __DATE__ and __TIME__ predefines. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2670 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/build.cpp | 22 +--------------------- Source/makenssi.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/Source/build.cpp b/Source/build.cpp index 5dab901b..ac7d3d4c 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -222,27 +222,7 @@ CEXEBuild::CEXEBuild() #ifdef NSIS_SUPPORT_STANDARD_PREDEFINES // Added by Sunil Kamath 11 June 2003 - { - time_t etime; - struct tm * ltime; - SYSTEMTIME stime; - char datebuf[32]; - char timebuf[32]; - - time(&etime); - ltime = localtime(&etime); - stime.wYear = ltime->tm_year+1900; - stime.wMonth = ltime->tm_mon + 1; - stime.wDay = ltime->tm_mday; - stime.wHour= ltime->tm_hour; - stime.wMinute= ltime->tm_min; - stime.wSecond= ltime->tm_sec; - stime.wMilliseconds= 0; - GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &stime, NULL, datebuf, sizeof(datebuf)); - definedlist.add("__DATE__",(char *)datebuf); - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stime, NULL, timebuf, sizeof(timebuf)); - definedlist.add("__TIME__",(char *)timebuf); - } + definedlist.add("NSIS_SUPPORT_STANDARD_PREDEFINES"); #endif db_opt_save=db_comp_save=db_full_size=db_opt_save_u=db_comp_save_u=db_full_size_u=0; diff --git a/Source/makenssi.cpp b/Source/makenssi.cpp index e62f1baf..035c8069 100644 --- a/Source/makenssi.cpp +++ b/Source/makenssi.cpp @@ -340,7 +340,38 @@ int main(int argc, char **argv) fprintf(g_output,"\n\nProcessing script file: \"%s\"\n",sfile); fflush(g_output); } +#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES + // Added by Sunil Kamath 23 June 2003 + { + time_t etime; + struct tm * ltime; + SYSTEMTIME stime; + char datebuf[32]; + char timebuf[32]; + + time(&etime); + ltime = localtime(&etime); + stime.wYear = ltime->tm_year+1900; + stime.wMonth = ltime->tm_mon + 1; + stime.wDay = ltime->tm_mday; + stime.wHour= ltime->tm_hour; + stime.wMinute= ltime->tm_min; + stime.wSecond= ltime->tm_sec; + stime.wMilliseconds= 0; + GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &stime, NULL, datebuf, sizeof(datebuf)); + build.definedlist.add("__DATE__",(char *)datebuf); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stime, NULL, timebuf, sizeof(timebuf)); + build.definedlist.add("__TIME__",(char *)timebuf); + } +#endif int ret=build.process_script(fp,sfile); +#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES + // Added by Sunil Kamath 23 June 2003 + { + build.definedlist.del("__DATE__"); + build.definedlist.del("__TIME__"); + } +#endif if (fp != stdin) fclose(fp); if (ret != PS_EOF && ret != PS_OK)