Patch to ogr/ogrsf_frmts/shape/dbfopen.c attached, which sets the dbf header's date to the current date on modification. Old code had the dbf header's date hardcoded to 07/26/95.
Tested on Linux. Hope it can make its way into OGR. -Dave
Index: ogr/ogrsf_frmts/shape/dbfopen.c =================================================================== --- ogr/ogrsf_frmts/shape/dbfopen.c (revision 15119) +++ ogr/ogrsf_frmts/shape/dbfopen.c (working copy) @@ -110,6 +110,7 @@ #include <stdlib.h> #include <ctype.h> #include <string.h> +#include <time.h> SHP_CVSID("$Id: dbfopen.c,v 1.74 2007/12/06 07:00:25 fwarmerdam Exp $") @@ -148,6 +149,8 @@ { unsigned char abyHeader[XBASE_FLDHDR_SZ]; int i; + time_t cur_time; + struct tm timestruct; if( !psDBF->bNoHeader ) return; @@ -162,10 +165,18 @@ abyHeader[0] = 0x03; /* memo field? - just copying */ - /* write out a dummy date */ - abyHeader[1] = 95; /* YY */ - abyHeader[2] = 7; /* MM */ - abyHeader[3] = 26; /* DD */ + if ((cur_time = time(NULL)) == 0) + { + /* TODO: handle error getting time() */ + } + tzset(); + if (localtime_r(&cur_time, ×truct) == NULL) + { + /* TODO: handle error calling localtime_r */ + } + abyHeader[1] = timestruct.tm_year % 100; /* YY */ + abyHeader[2] = timestruct.tm_mon + 1; /* MM */ + abyHeader[3] = timestruct.tm_mday; /* DD */ /* record count preset at zero */
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev