- removed the build time in favor of commit time which I think is much more important

Sat, 17 May 2014 15:45:56 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 17 May 2014 15:45:56 +0300
changeset 774
8bce7acd100c
parent 773
6eb3c88982ac
child 775
4661d6e83630

- removed the build time in favor of commit time which I think is much more important

src/mainWindow.cc file | annotate | diff | comparison | revisions
src/version.cc file | annotate | diff | comparison | revisions
src/version.h file | annotate | diff | comparison | revisions
updaterevision/updaterevision.c file | annotate | diff | comparison | revisions
--- a/src/mainWindow.cc	Sat May 17 15:38:20 2014 +0300
+++ b/src/mainWindow.cc	Sat May 17 15:45:56 2014 +0300
@@ -278,8 +278,8 @@
 	title += " [pre-release build]";
 #endif // DEBUG
 
-	if (compileTimeString()[0] != '\0')
-		title += format (" (built %1)", compileTimeString());
+	if (commitTimeString()[0] != '\0')
+		title += format (" (%1)", commitTimeString());
 
 	setWindowTitle (title);
 }
--- a/src/version.cc	Sat May 17 15:38:20 2014 +0300
+++ b/src/version.cc	Sat May 17 15:45:56 2014 +0300
@@ -63,11 +63,11 @@
 
 // =============================================================================
 //
-const char* compileTimeString()
+const char* commitTimeString()
 {
-#ifdef BUILD_TIME
+#ifdef GIT_TIME
 	if (g_buildTime[0] == '\0')
-		strcpy (g_buildTime, BUILD_TIME);
+		strcpy (g_buildTime, GIT_TIME);
 #endif
 
 	return g_buildTime;
--- a/src/version.h	Sat May 17 15:38:20 2014 +0300
+++ b/src/version.h	Sat May 17 15:45:56 2014 +0300
@@ -16,36 +16,28 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-//! \file version.h
-//! Contains macros related to application name and version.
-
 #pragma once
 
-//! The application name.
+//
+// Application name
+//
 #define APPNAME			"LDForge"
-
-//! The unix-style name of the application. used in filenames
 #define UNIXNAME		"ldforge"
 
-//! The major version number.
+//
+// Version number
+//
 #define VERSION_MAJOR	0
-
-//! The minor version number.
 #define VERSION_MINOR	3
-
-//! The patch level version number.
 #define VERSION_PATCH	0
 
-//! The build ID, use either BUILD_INTERNAL or BUILD_RELEASE
+//
+// Build ID, this is BUILD_RELEASE for releases
+//
 #define BUILD_ID		BUILD_INTERNAL
-
-//! The build code for internal builds
 #define BUILD_INTERNAL	0
-
-//! The build code for release builds.
 #define BUILD_RELEASE	1
 
-// =============================================
 #ifdef DEBUG
 # undef RELEASE
 #endif // DEBUG
@@ -56,4 +48,4 @@
 
 const char* versionString();
 const char* fullVersionString();
-const char* compileTimeString();
+const char* commitTimeString();
--- a/updaterevision/updaterevision.c	Sat May 17 15:38:20 2014 +0300
+++ b/updaterevision/updaterevision.c	Sat May 17 15:45:56 2014 +0300
@@ -38,12 +38,6 @@
 	char vertag[128], lastlog[128], lasthash[128], *hash = NULL;
 	FILE *stream = NULL;
 	int gotrev = 0, needupdate = 1;
-
-	// [SP] Stuff for build time.
-	time_t now;
-	char currentTime[128];
-	char* cp;
-
 	vertag[0] = '\0';
 	lastlog[0] = '\0';
 
@@ -99,12 +93,10 @@
 			fclose (stream);
 			return 0;
 		}
+
 		// Read the revision that's in this file already. If it's the same as
 		// what we've got, then we don't need to modify it and can avoid rebuilding
 		// dependant files.
-		// [SP] I'm including build date in the file now so it must always be rebuilt.
-		// In LDForge, this is only used by the very-quick-to-build version.cc anyway.
-#if 0
 		if (fgets(lasthash, sizeof lasthash, stream) == lasthash)
 		{
 			stripnl(lasthash);
@@ -113,24 +105,9 @@
 				needupdate = 0;
 			}
 		}
-#endif
 		fclose (stream);
 	}
 
-	// [SP] Current time.
-	now = time (NULL);
-	strftime (currentTime, sizeof currentTime, "%F %T %z", localtime (&now));
-
-	// [SP] For some dumb reason asctime includes a newline character. Get rid of it.
-	for (cp = &currentTime[0]; *cp != '\0'; ++cp)
-	{
-		if (*cp == '\n')
-		{
-			*cp = '\0';
-			break;
-		}
-	}
-
 	if (needupdate)
 	{
 		stream = fopen (argv[1], "w");
@@ -146,11 +123,10 @@
 "\n"
 "#define GIT_DESCRIPTION \"%s\"\n"
 "#define GIT_HASH \"%s\"\n"
-"#define GIT_TIME \"%s\"\n"
-"#define BUILD_TIME \"%s\"\n",
-			hash, vertag, hash, lastlog, currentTime);
+"#define GIT_TIME \"%s\"\n",
+			hash, vertag, hash, lastlog);
 		fclose(stream);
-		fprintf(stderr, "%s updated to commit %s (build time: %s).\n", argv[1], vertag, currentTime);
+		fprintf(stderr, "%s updated to commit %s.\n", argv[1], vertag);
 	}
 	else
 	{

mercurial