diff options
Diffstat (limited to 'libarchive/test/test_write_format_zip_compression_store.c')
-rw-r--r-- | libarchive/test/test_write_format_zip_compression_store.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/libarchive/test/test_write_format_zip_compression_store.c b/libarchive/test/test_write_format_zip_compression_store.c index c969a41d4d41..ed0908787579 100644 --- a/libarchive/test/test_write_format_zip_compression_store.c +++ b/libarchive/test/test_write_format_zip_compression_store.c @@ -128,12 +128,31 @@ static void verify_uncompressed_contents(const char *buff, size_t used) /* Misc variables */ unsigned long crc; - struct tm *tm = localtime(&now); - + 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 /* p is the pointer to walk over the central directory, * q walks over the local headers, the data and the data descriptors. */ const char *p, *q, *local_header, *extra_start; +#if defined(HAVE_LOCALTIME_R) + tm = localtime_r(&now, &tmbuf); +#elif defined(HAVE__LOCALTIME64_S) + tmptime = now; + terr = _localtime64_s(&tmbuf, &tmptime); + if (terr) + tm = NULL; + else + tm = &tmbuf; +#else + tm = localtime(&now); +#endif + /* Remember the end of the archive in memory. */ buffend = buff + used; |