b99aaab26e9c9f9a5f5b9e0c9be024e8a9f10b38 galt Wed Feb 13 12:57:49 2013 -0800 time should be time_t or long but not int, so that the 2030 overflow problem is avoided on 64-bit machines diff --git src/hg/lib/targetDb.c src/hg/lib/targetDb.c index 404c4f1..7e21f90 100644 --- src/hg/lib/targetDb.c +++ src/hg/lib/targetDb.c @@ -181,52 +181,52 @@ } /* -------------------------------- End autoSql Generated Code -------------------------------- */ #include "portable.h" #include "hdb.h" #include "ra.h" static boolean timeMoreRecentThanTable(int time, struct sqlConnection *conn, char *table) /* Return TRUE if the given UNIX time is more recent than the time that * table was last updated. */ { if (! sqlTableExists(conn, table)) return FALSE; -int tableUpdateTime = sqlTableUpdateTime(conn, table); +long tableUpdateTime = sqlTableUpdateTime(conn, table); return (time > tableUpdateTime); } -static boolean timeMoreRecentThanFile(int time, char *fileName) +static boolean timeMoreRecentThanFile(long time, char *fileName) /* Return TRUE if the given UNIX time is more recent than the time that * fileName was last modified. */ { if (! fileExists(fileName)) return FALSE; -int fileUpdateTime = fileModTime(fileName); +long fileUpdateTime = fileModTime(fileName); return (time > fileUpdateTime); } struct targetDb *targetDbMaybeLoad(struct sqlConnection *conn, char **row) /* If row specifies a target whose tables and file exist, and are not newer * than target, allocate and return a targetDb; otherwise, return NULL * and log a warning to stderr for QA monitoring. */ { struct targetDb target; targetDbStaticLoad(row, &target); -int time = sqlDateToUnixTime(target.time); +long time = sqlDateToUnixTime(target.time); if (timeMoreRecentThanTable(time, conn, target.pslTable) && (isEmpty(target.seqTable) || timeMoreRecentThanTable(time, conn, target.seqTable)) && (isEmpty(target.extFileTable) || timeMoreRecentThanTable(time, conn, target.extFileTable)) && /* Here is where we could add a configurable slush factor: */ timeMoreRecentThanFile(time, target.seqFile)) { return targetDbLoad(row); } else fprintf(stderr, "targetDb entry %s is dated %s -- older than at " "least one of its db tables (%s, %s, %s) " "or its sequence file in %s.\n", target.name, target.time, target.pslTable, target.seqTable,