diff --git a/lib/libarchive/archive_entry.3 b/lib/libarchive/archive_entry.3
index 026444ee8a12..2f82f89d033a 100644
--- a/lib/libarchive/archive_entry.3
+++ b/lib/libarchive/archive_entry.3
@@ -71,6 +71,7 @@
 .Nm archive_entry_set_hardlink ,
 .Nm archive_entry_set_link ,
 .Nm archive_entry_set_mode ,
+.Nm archive_entry_set_mtime ,
 .Nm archive_entry_set_pathname ,
 .Nm archive_entry_set_rdevmajor ,
 .Nm archive_entry_set_rdevminor ,
@@ -171,6 +172,8 @@
 .Ft void
 .Fn archive_entry_set_mode "struct archive_entry *" "mode_t"
 .Ft void
+.Fn archive_entry_set_mtime "struct archive_entry *" "time_t" "long nanos"
+.Ft void
 .Fn archive_entry_set_pathname "struct archive_entry *" "const char *"
 .Ft void
 .Fn archive_entry_set_rdevmajor "struct archive_entry *" "dev_t"
diff --git a/lib/libarchive/archive_entry.c b/lib/libarchive/archive_entry.c
index f6694309600c..db92789bacda 100644
--- a/lib/libarchive/archive_entry.c
+++ b/lib/libarchive/archive_entry.c
@@ -584,6 +584,13 @@ archive_entry_set_mode(struct archive_entry *entry, mode_t m)
 	entry->ae_stat.st_mode = m;
 }
 
+void
+archive_entry_set_mtime(struct archive_entry *entry, time_t m, long ns)
+{
+	entry->ae_stat.st_mtime = m;
+	ARCHIVE_STAT_SET_MTIME_NANOS(&entry->ae_stat, ns);
+}
+
 void
 archive_entry_set_pathname(struct archive_entry *entry, const char *name)
 {
diff --git a/lib/libarchive/archive_entry.h b/lib/libarchive/archive_entry.h
index 96d40f9c552b..e5bdaf645a3c 100644
--- a/lib/libarchive/archive_entry.h
+++ b/lib/libarchive/archive_entry.h
@@ -110,6 +110,7 @@ void	archive_entry_copy_hardlink(struct archive_entry *, const char *);
 void	archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *);
 void	archive_entry_set_link(struct archive_entry *, const char *);
 void	archive_entry_set_mode(struct archive_entry *, mode_t);
+void	archive_entry_set_mtime(struct archive_entry *, time_t, long);
 void	archive_entry_set_pathname(struct archive_entry *, const char *);
 void	archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *);
 void	archive_entry_set_rdevmajor(struct archive_entry *, dev_t);