20 // makes this simple file very fast to compile, which is nice since this file |
20 // makes this simple file very fast to compile, which is nice since this file |
21 // must be compiled every time I commit something. |
21 // must be compiled every time I commit something. |
22 |
22 |
23 #include <stdio.h> |
23 #include <stdio.h> |
24 #include <string.h> |
24 #include <string.h> |
|
25 #include <time.h> |
25 #include "version.h" |
26 #include "version.h" |
26 #include "gitinfo.h" |
27 #include "hginfo.h" |
27 |
28 |
28 char g_versionString[64] = {'\0'}; |
29 char g_versionString[64] = {'\0'}; |
29 char g_fullVersionString[256] = {'\0'}; |
30 char g_fullVersionString[256] = {'\0'}; |
30 char g_buildTime[256] = {'\0'}; |
31 char g_buildTime[256] = {'\0'}; |
31 |
32 |
49 // |
50 // |
50 const char* fullVersionString() |
51 const char* fullVersionString() |
51 { |
52 { |
52 if (g_fullVersionString[0] == '\0') |
53 if (g_fullVersionString[0] == '\0') |
53 { |
54 { |
54 #if BUILD_ID != BUILD_RELEASE |
55 #if BUILD_ID != BUILD_RELEASE && defined (SVN_REVISION_STRING) |
55 strcpy (g_fullVersionString, GIT_DESCRIPTION); |
56 strcpy (g_fullVersionString, SVN_REVISION_STRING); |
56 #else |
57 #else |
57 sprintf (g_fullVersionString, "v%s", versionString()); |
58 sprintf (g_fullVersionString, "v%s", versionString()); |
58 #endif |
59 #endif |
59 } |
60 } |
60 |
61 |
63 |
64 |
64 // ============================================================================= |
65 // ============================================================================= |
65 // |
66 // |
66 const char* commitTimeString() |
67 const char* commitTimeString() |
67 { |
68 { |
68 #ifdef GIT_TIME |
69 #ifdef SVN_REVISION_NUMBER |
69 if (g_buildTime[0] == '\0') |
70 if (g_buildTime[0] == '\0') |
70 strcpy (g_buildTime, GIT_TIME); |
71 { |
|
72 time_t timestamp = SVN_REVISION_NUMBER; |
|
73 strftime (g_buildTime, sizeof g_buildTime, "%d %b %Y %T", localtime (×tamp)); |
|
74 } |
71 #endif |
75 #endif |
72 |
76 |
73 return g_buildTime; |
77 return g_buildTime; |
74 } |
78 } |