expand version.h with last modified times

This commit is contained in:
Tim Felgentreff 2020-11-23 09:46:09 +01:00
parent 696e8bccd7
commit 08c93416c0
2 changed files with 8 additions and 1 deletions

View file

@ -38,4 +38,4 @@
#define LICENSE "GPL v2"
/// Copyright
#define COPYRIGHT "Copyright (c) 1998-2015 by The Stratagus Project"
#define COPYRIGHT "Copyright (c) 1998-2020 by The Stratagus Project"

View file

@ -30,6 +30,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/* usage: genversion "/path/to/version-generated.h" "major.minor.path.patch2" */
@ -120,9 +121,15 @@ int main(int argc, char * argv[]) {
fprintf(file, "#define StratagusPatchLevel %d\n", new_ver[2]);
fprintf(file, "#define StratagusPatchLevel2 %d\n", new_ver[3]);
if ( git_rev != NULL )
fprintf(file, "#define StratagusGitRev %s\n", git_rev);
time_t tt = time(NULL);
struct tm *tm = gmtime(&tt);
fprintf(file, "#define StratagusLastModifiedDate \"%02d/%02d/%02d\"\n", tm->tm_mon + 1, tm->tm_mday, tm->tm_year + 1900);
fprintf(file, "#define StratagusLastModifiedTime \"%02d:%02d:%02d\"\n", tm->tm_hour, tm->tm_min, tm->tm_sec);
fclose(file);
return 0;