]> wimlib.net Git - wimlib/blobdiff - src/dentry.c
Timestamp printing UTC
[wimlib] / src / dentry.c
index ac158e84d5f48f4ec712ecba1b22eee609c51aa7..8a285e25a0b6f4590a4efac5d3e622eced0e8b42 100644 (file)
@@ -85,6 +85,12 @@ static u64 __dentry_total_length(const struct dentry *dentry, u64 length)
        return (length + 7) & ~7;
 }
 
+u64 dentry_correct_total_length(const struct dentry *dentry)
+{
+       return __dentry_total_length(dentry,
+                                    dentry_correct_length_unaligned(dentry));
+}
+
 /* Real length of a dentry, including the alternate data stream entries, which
  * are not included in the dentry->length field... */
 u64 dentry_total_length(const struct dentry *dentry)
@@ -341,8 +347,7 @@ void calculate_subdir_offsets(struct dentry *dentry, u64 *subdir_offset_p)
                /* Advance the subdir offset by the amount of space the children
                 * of this dentry take up. */
                do {
-                       *subdir_offset_p += __dentry_total_length(child,
-                                                                 dentry_correct_length(child));
+                       *subdir_offset_p += dentry_correct_total_length(child);
                        child = child->next;
                } while (child != dentry->children);
 
@@ -474,6 +479,8 @@ int print_dentry(struct dentry *dentry, void *lookup_table)
 {
        const u8 *hash;
        struct lookup_table_entry *lte;
+       time_t time;
+       char *p;
 
        printf("[DENTRY]\n");
        printf("Length            = %"PRIu64"\n", dentry->length);
@@ -498,9 +505,21 @@ int print_dentry(struct dentry *dentry, void *lookup_table)
        time_t creat_time = wim_timestamp_to_unix(dentry->creation_time);
        time_t access_time = wim_timestamp_to_unix(dentry->last_access_time);
        time_t mod_time = wim_timestamp_to_unix(dentry->last_write_time);
-       printf("Creation Time     = %s", asctime(gmtime(&creat_time)));
-       printf("Last Access Time  = %s", asctime(gmtime(&access_time)));
-       printf("Last Write Time   = %s", asctime(gmtime(&mod_time)));
+
+       time = wim_timestamp_to_unix(dentry->creation_time);
+       p = asctime(gmtime(&time));
+       *(strrchr(p, '\n')) = '\0';
+       printf("Creation Time     = %s UTC\n", p);
+
+       time = wim_timestamp_to_unix(dentry->last_access_time);
+       p = asctime(gmtime(&time));
+       *(strrchr(p, '\n')) = '\0';
+       printf("Last Access Time  = %s UTC\n", p);
+
+       time = wim_timestamp_to_unix(dentry->last_write_time);
+       p = asctime(gmtime(&time));
+       *(strrchr(p, '\n')) = '\0';
+       printf("Last Write Time   = %s UTC\n", p);
 
        printf("Reparse Tag       = 0x%"PRIx32"\n", dentry->reparse_tag);
        printf("Hard Link Group   = 0x%"PRIx64"\n", dentry->hard_link);
@@ -1309,7 +1328,7 @@ int verify_dentry(struct dentry *dentry, void *wim)
        for (unsigned i = 0; i <= dentry->num_ads; i++) {
                const u8 *hash;
                hash = dentry_stream_hash_unresolved(dentry, i);
-               if (dentry_stream_name_len(dentry, i) && !is_zero_hash(hash)) {
+               if (!dentry_stream_name_len(dentry, i) && !is_zero_hash(hash)) {
                        num_unnamed_streams++;
                        unnamed_stream_idx = i;
                }