bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] gnutar 1.17


From: Sergey Poznyakoff
Subject: Re: [Bug-tar] gnutar 1.17
Date: Thu, 18 Mar 2010 17:05:37 +0200

Mark Adler <address@hidden> ha escrit:

> Is there an option to get the seconds back?

No, so far there is not.  You may try the attached patch, though.
It adds the --full-time option, which does what you want.

Regards,
Sergey

diff --git a/src/common.h b/src/common.h
index d2de528..f794ba9 100644
--- a/src/common.h
+++ b/src/common.h
@@ -105,6 +105,8 @@ GLOBAL bool absolute_names_option;
 
 /* Display file times in UTC */
 GLOBAL bool utc_option;
+/* Display full file times */
+GLOBAL bool full_time_option;
 
 /* This variable tells how to interpret newer_mtime_option, below.  If zero,
    files get archived if their mtime is not less than newer_mtime_option.
diff --git a/src/list.c b/src/list.c
index 0474fb1..ac7c8fb 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1146,7 +1146,7 @@ simple_print_header (struct tar_stat_info *st, union 
block *blk,
 
       /* Time stamp.  */
 
-      time_stamp = tartime (st->mtime, false);
+      time_stamp = tartime (st->mtime, full_time_option);
       time_stamp_len = strlen (time_stamp);
       if (datewidth < time_stamp_len)
        datewidth = time_stamp_len;
diff --git a/src/tar.c b/src/tar.c
index e3fdf7b..4d84771 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -274,6 +274,7 @@ enum
   EXCLUDE_TAG_ALL_OPTION,
   EXCLUDE_VCS_OPTION,
   FORCE_LOCAL_OPTION,
+  FULL_TIME_OPTION,
   GROUP_OPTION,
   IGNORE_CASE_OPTION,
   IGNORE_COMMAND_ERROR_OPTION,
@@ -753,6 +754,8 @@ static struct argp_option options[] = {
       "the names without SIG prefix are also accepted"), GRID+1 },
   {"utc", UTC_OPTION, 0, 0,
    N_("print file modification dates in UTC"), GRID+1 },
+  {"full-time", FULL_TIME_OPTION, 0, 0,
+   N_("print file times with a maximum possible resolution"), GRID+1 },
   {"index-file", INDEX_FILE_OPTION, N_("FILE"), 0,
    N_("send verbose output to FILE"), GRID+1 },
   {"block-number", 'R', 0, 0,
@@ -1437,6 +1440,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
       info_script_option = arg;
       multi_volume_option = true;
       break;
+
+    case FULL_TIME_OPTION:
+      full_time_option = true;
+      break;
       
     case 'g':
       listed_incremental_option = arg;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]