Timestamp printing UTC
authorEric Biggers <ebiggers3@gmail.com>
Tue, 28 Aug 2012 22:30:50 +0000 (17:30 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 28 Aug 2012 22:30:50 +0000 (17:30 -0500)
src/dentry.c
src/xml.c

index 4d3fc6825e41c726e6a3e8d09644d2b49557a89f..8a285e25a0b6f4590a4efac5d3e622eced0e8b42 100644 (file)
@@ -479,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);
@@ -503,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);
index 0de179c496fb0fd79fe4e371810670d9ee6fb108..943fb8340020c801084ebda14d8b9c7a60838dd6 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -1035,14 +1035,15 @@ void print_image_info(const struct wim_info *wim_info, int image)
        uint i;
        const struct image_info *image_info;
        const char *desc;
-       time_t ctime;
-       time_t mtime;
 
 
        if (image == WIM_ALL_IMAGES) {
                for (i = 1; i <= wim_info->num_images; i++)
                        print_image_info(wim_info, i);
        } else {
+               time_t time;
+               char *p;
+
                image_info = &wim_info->images[image - 1];
 
                printf("Index:                  %"PRIu64"\n", 
@@ -1075,11 +1076,17 @@ void print_image_info(const struct wim_info *wim_info, int image)
                printf("Hard Link Bytes:        %"PRIu64"\n", 
                                image_info->hard_link_bytes);
 
-               ctime = wim_timestamp_to_unix(image_info->creation_time);
-               mtime = wim_timestamp_to_unix(image_info->last_modification_time);
+               time = wim_timestamp_to_unix(image_info->creation_time);
+               p = asctime(gmtime(&time));
+               *(strrchr(p, '\n')) = '\0';
+
+               printf("Creation Time:          %s UTC\n", p);
+
+               time = wim_timestamp_to_unix(image_info->last_modification_time);
+               p = asctime(gmtime(&time));
+               *(strrchr(p, '\n')) = '\0';
 
-               printf("Creation Time:          %s", asctime(localtime(&ctime)));
-               printf("Last Modification Time: %s", asctime(localtime(&mtime)));
+               printf("Last Modification Time: %s UTC\n", p);
                if (image_info->windows_info_exists)
                        print_windows_info(&image_info->windows_info);
                if (image_info->flags)