summaryrefslogtreecommitdiff
path: root/cpio/cpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpio/cpio.c')
-rw-r--r--cpio/cpio.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/cpio/cpio.c b/cpio/cpio.c
index f8dd62c5..da5c3986 100644
--- a/cpio/cpio.c
+++ b/cpio/cpio.c
@@ -1140,9 +1140,13 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
time_t mtime;
static time_t now;
struct tm *ltime;
-#ifdef HAVE_LOCALTIME_R
+#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
if (!now)
time(&now);
@@ -1190,10 +1194,17 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
else
fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M";
#endif
-#ifdef HAVE_LOCALTIME_R
+#if defined(HAVE_LOCALTIME_R)
ltime = localtime_r(&mtime, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = mtime;
+ terr = _localtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ ltime = NULL;
+ else
+ ltime = &tmbuf;
#else
- ltime = localtime(&mtime)
+ ltime = localtime(&mtime);
#endif
strftime(date, sizeof(date), fmt, ltime);