diff options
Diffstat (limited to 'libarchive/test/test_write_format_zip_file_zip64.c')
-rw-r--r-- | libarchive/test/test_write_format_zip_file_zip64.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libarchive/test/test_write_format_zip_file_zip64.c b/libarchive/test/test_write_format_zip_file_zip64.c index 71da9866..c4161bc3 100644 --- a/libarchive/test/test_write_format_zip_file_zip64.c +++ b/libarchive/test/test_write_format_zip_file_zip64.c @@ -75,7 +75,14 @@ DEFINE_TEST(test_write_format_zip_file_zip64) struct archive *a; struct archive_entry *ae; time_t t = 1234567890; - struct tm *tm = localtime(&t); + struct tm *tm; +#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S) + struct tm tmbuf; +#endif +#if defined(HAVE__LOCALTIME64_S) + errno_t terr; + __time64_t tmptime; +#endif size_t used, buffsize = 1000000; unsigned long crc; int file_perm = 00644; @@ -92,6 +99,18 @@ DEFINE_TEST(test_write_format_zip_file_zip64) zip_compression = 0; #endif +#if defined(HAVE_LOCALTIME_R) + tm = localtime_r(&t, &tmbuf); +#elif defined(HAVE__LOCALTIME64_S) + tmptime = t; + terr = _localtime64_s(&tmbuf, &tmptime); + if (terr) + tm = NULL; + else + tm = &tmbuf; +#else + tm = localtime(&t); +#endif buff = malloc(buffsize); /* Create a new archive in memory. */ |