[GRASS-SVN] r54830 - grass/trunk/general/g.version

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 1 08:10:12 PST 2013


Author: martinl
Date: 2013-02-01 08:10:11 -0800 (Fri, 01 Feb 2013)
New Revision: 54830

Modified:
   grass/trunk/general/g.version/date.c
Log:
g.version: fix build date (day < 10)


Modified: grass/trunk/general/g.version/date.c
===================================================================
--- grass/trunk/general/g.version/date.c	2013-01-31 21:59:59 UTC (rev 54829)
+++ grass/trunk/general/g.version/date.c	2013-02-01 16:10:11 UTC (rev 54830)
@@ -22,14 +22,19 @@
 const char *get_date()
 {
     char *date = NULL;
-    char month[3];
+    char month[3], day[3];
     
     if (MONTH < 9)
 	sprintf(month, "0%d", MONTH + 1);
     else
 	sprintf(month, "%d", MONTH + 1);
     
-    G_asprintf(&date, "%d-%s-%d", YEAR, month, DAY);
+    if (DAY < 10)
+	sprintf(day, "0%d", DAY);
+    else
+	sprintf(day, "%d", DAY);
+        
+    G_asprintf(&date, "%d-%s-%s", YEAR, month, day);
     
     return date;
 }



More information about the grass-commit mailing list