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
This commit is contained in:
icemank 2003-06-23 16:25:07 +00:00
parent 0b6ed99e50
commit c9456e766f
2 changed files with 32 additions and 21 deletions

View file

@ -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;

View file

@ -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)