tests: datetime: Fix failure on Windows

The documentation for WIN32 mktime indicates that for struct tm*
before January 1, 1970, that -1 is returned, and since mktime is timezone
dependent, the struct tm corresponding to 1:00, Jan. 1, 1970 might be failed.

See also
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/mktime-mktime32-mktime64
This commit is contained in:
Seungha Yang 2018-12-17 23:29:16 +09:00
parent 1bca404191
commit 2c0951774b

View file

@ -85,7 +85,7 @@ GST_START_TEST (test_GstDateTime_new_from_unix_epoch_local_time)
memset (&tm, 0, sizeof (tm));
tm.tm_year = 70;
tm.tm_mday = 1;
tm.tm_mday = 2;
tm.tm_mon = 0;
tm.tm_hour = 1;
tm.tm_min = 0;
@ -95,7 +95,7 @@ GST_START_TEST (test_GstDateTime_new_from_unix_epoch_local_time)
dt = gst_date_time_new_from_unix_epoch_local_time (t);
assert_equals_int (gst_date_time_get_year (dt), 1970);
assert_equals_int (gst_date_time_get_month (dt), 1);
assert_equals_int (gst_date_time_get_day (dt), 1);
assert_equals_int (gst_date_time_get_day (dt), 2);
assert_equals_int (gst_date_time_get_hour (dt), 1);
assert_equals_int (gst_date_time_get_minute (dt), 0);
assert_equals_int (gst_date_time_get_second (dt), 0);