mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-12-21 11:00:04 +08:00
Fix libmdbsql build on Windows
This commit is contained in:
@@ -36,7 +36,7 @@ AC_CHECK_DECLS([program_invocation_short_name], [], [], [[
|
||||
|
||||
dnl Checks for library functions.
|
||||
VL_LIB_READLINE
|
||||
AC_CHECK_FUNCS(strptime fmemopen)
|
||||
AC_CHECK_FUNCS(strptime fmemopen gmtime_r)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
|
||||
@@ -763,9 +763,14 @@ int mdb_sql_find_sargcol(MdbSargNode *node, gpointer data)
|
||||
* Plain integers are UNIX timestamps for backwards compatibility of parser
|
||||
*/
|
||||
if (col->col_type == MDB_DATETIME && node->val_type == MDB_INT) {
|
||||
struct tm *tmp;
|
||||
#ifdef HAVE_GMTIME_R
|
||||
struct tm tm;
|
||||
gmtime_r((time_t*)&node->value.i, &tm);
|
||||
mdb_tm_to_date(&tm, &node->value.d);
|
||||
tmp = gmtime_r((time_t*)&node->value.i, &tm);
|
||||
#else // regular gmtime on Windows uses thread-local storage
|
||||
tmp = gmtime((time_t*)&node->value.i);
|
||||
#endif
|
||||
mdb_tm_to_date(tmp, &node->value.d);
|
||||
node->val_type = MDB_DOUBLE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user