]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
In mtree format, add nano second entry to the time keyword output.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 29 Jan 2009 09:20:44 +0000 (04:20 -0500)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 29 Jan 2009 09:20:44 +0000 (04:20 -0500)
It is the same as mtree(8).

SVN-Revision: 511

libarchive/archive_read_support_format_mtree.c
libarchive/archive_write_set_format_mtree.c

index de801056e2dd0d389b620dea5e96e9531e3af0c0..f83fe5d33704257c1d74300ba479c42d86c8d9c1 100644 (file)
@@ -882,8 +882,17 @@ parse_keyword(struct archive_read *a, struct mtree *mtree,
                        break;
                }
                if (strcmp(key, "time") == 0) {
+                       time_t m;
+                       long ns;
+
                        *parsed_kws |= MTREE_HAS_MTIME;
-                       archive_entry_set_mtime(entry, mtree_atol10(&val), 0);
+                       m = (time_t)mtree_atol10(&val);
+                       if (*val == '.') {
+                               ++val;
+                               ns = (long)mtree_atol10(&val);
+                       } else
+                               ns = 0;
+                       archive_entry_set_mtime(entry, m, ns);
                        break;
                }
                if (strcmp(key, "type") == 0) {
index b057155021691c1e52a8fb5db7969809b6f0c82f..d7f604b32f006c9c2fe0f94abfcd6d2c1aad4992 100644 (file)
@@ -355,8 +355,9 @@ archive_write_mtree_finish_entry(struct archive_write *a)
                mtree_quote(mtree, name);
        }
        if ((mtree->keys & F_TIME) != 0)
-               archive_string_sprintf(&mtree->buf, " time=%jd",
-                   (intmax_t)archive_entry_mtime(entry));
+               archive_string_sprintf(&mtree->buf, " time=%jd.%jd",
+                   (intmax_t)archive_entry_mtime(entry),
+                   (intmax_t)archive_entry_mtime_nsec(entry));
        if ((mtree->keys & F_MODE) != 0)
                archive_string_sprintf(&mtree->buf, " mode=%o",
                    archive_entry_mode(entry) & 07777);