diff --git a/lib/client.c b/lib/client.c index 587cdb1692..6c82e46ef7 100644 --- a/lib/client.c +++ b/lib/client.c @@ -3253,15 +3253,17 @@ SF_STATUS STDCALL snowflake_timestamp_get_epoch_seconds(SF_TIMESTAMP *ts, return SF_STATUS_ERROR_NULL_POINTER; } - time_t epoch_time_local; + time_t epoch_time; ts->tm_obj.tm_isdst = -1; - epoch_time_local = (time_t) mktime(&ts->tm_obj); // mktime takes into account tm_gmtoff which is a Linux and OS X ONLY field #if defined(__linux__) || defined(__APPLE__) - epoch_time_local += ts->tm_obj.tm_gmtoff; + epoch_time = (time_t)mktime(&ts->tm_obj); + epoch_time += ts->tm_obj.tm_gmtoff; +#else + epoch_time = _mkgmtime64(&ts->tm_obj); #endif - *epoch_time_ptr = epoch_time_local - (ts->tzoffset * 60); + *epoch_time_ptr = epoch_time - (ts->tzoffset * 60); return SF_STATUS_SUCCESS; } diff --git a/tests/test_column_fetch.c b/tests/test_column_fetch.c index 7dfa572432..e9c452c12f 100644 --- a/tests/test_column_fetch.c +++ b/tests/test_column_fetch.c @@ -946,9 +946,6 @@ void test_column_as_timestamp_windows_helper(sf_bool use_arrow) { ? "alter session set C_API_QUERY_RESULT_FORMAT=ARROW_FORCE" : "alter session set C_API_QUERY_RESULT_FORMAT=JSON"); - sf_setenv("TZ", "UTC"); - sf_tzset(); - snowflake_query(sfstmt, "select " "NULL, " "to_timestamp_tz('2018-10-10 12:34:56 -7:00'), "