]> Dogcows Code - chaz/tar/commitdiff
New option --full-time.
authorSergey Poznyakoff <gray@gnu.org.ua>
Sun, 28 Mar 2010 09:20:51 +0000 (12:20 +0300)
committerSergey Poznyakoff <gray@gnu.org.ua>
Sun, 28 Mar 2010 09:26:37 +0000 (12:26 +0300)
* src/common.h (full_time_option): New global.
* src/tar.c (FULL_TIME_OPTION): New constant.
(options): New option --full-time.
(parse_opt): Handle the --full-time option.
* src/list.c (simple_print_header): Pass full_time_option
as the 2nd argument to tartime.
* doc/tar.texi: Update.
* NEWS: Update.

NEWS
doc/tar.texi
src/common.h
src/list.c
src/tar.c

diff --git a/NEWS b/NEWS
index 1d3541469d0cd212c7e0aceeaffaf9c004dc4576..c8d614df07868574042c255beb7c0ad67d4911d2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,13 @@
-GNU tar NEWS - User visible changes. 2010-03-27
+GNU tar NEWS - User visible changes. 2010-03-28
 Please send GNU tar bug reports to <bug-tar@gnu.org>
 
 \f
 
+* The --full-time option.
+
+New command line option `--full-time' instructs tar to output file
+time stamps to the full resolution.
+
 * Bugfixes.
 
 ** Spurious error diagnostics on broken pipe.
@@ -239,10 +244,10 @@ can be changed using `flags=' statement before the expressions, e.g.:
 
 ** The --null option disabled handling of tar options in list files.  This
 is fixed.
-** Fixed record size autodetection.  If detected record size differs from
-the expected value (either default, or set on the command line), tar
-always prints a warning if verbosity level is set to 1 or greater,
-i.e. if either -t or -v option is given.
+** Fixed record size autodetection.  If the detected record size differs from
+the expected value (either default one, or the one set from the
+command line), tar always prints a warning if verbosity level is set
+to 1 or greater, i.e. if either -t or -v option is given.
 
 \f
 
@@ -342,7 +347,7 @@ settings.
 
 When supplied an archive smaller than 512 bytes in reading mode (-x,
 -t), the previous version of tar silently ignored it, exiting with
-code 0. It is fixed. Tar now issues the following diagnostic message:
+code 0.  It is fixed.  Tar now issues the following diagnostic message:
 'This does not look like a tar archive', and exits with code 2.
 
 * Fix double-dot recognition in archive member names in case of duplicate '/.'.
index 9bca1ef7d16a6041a69534ff1b8f3ea006b3f210..ed93e579b64bdba4e1315f7b28569bac728c431a 100644 (file)
@@ -2684,6 +2684,30 @@ Creates a @acronym{POSIX.1-2001 archive}.
 
 @xref{Formats}, for a detailed discussion of these formats.
 
+@opsummary{full-time}
+@item --full-time
+This option instructs @command{tar} to print file times to their full
+resolution.  Usually this means 1-second resolution, but that depends
+on the underlying file system.  The @option{--full-time} option takes
+effect only when detailed output (verbosity level 2 or higher) has
+been requested using the @option{--verbose} option, e.g., when listing
+or extracting archives:
+
+@smallexample
+$ @kbd{tar -t -v --full-time -f archive.tar}
+@end smallexample
+
+@noindent
+or, when creating an archive:
+
+@smallexample
+$ @kbd{tar -c -vv --full-time -f archive.tar .}
+@end smallexample
+
+Notice, thar when creating the archive you need to specify
+@option{--verbose} twice to get a detailed output (@pxref{verbose
+tutorial}).
+
 @opsummary{group}
 @item --group=@var{group}
 
index d2de528e0e94809eef7fa0efbb1e3a8975faa3ad..3b91f464c5a62d0f39779e327d3b76e8c36a3d5d 100644 (file)
@@ -105,6 +105,8 @@ GLOBAL bool absolute_names_option;
 
 /* Display file times in UTC */
 GLOBAL bool utc_option;
+/* Output file timestamps to the full resolution */
+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.
index 0474fb1e5ad40a02cab4f5c76f076ed7e1e9ffc3..ac7c8fb209395fcebe346fcbcbc0b11c50cac51e 100644 (file)
@@ -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;
index b127963fb58298074b634f6efec30b17a44570e9..21c396d56601ca0c0ed9e2edd497a457bea14610 100644 (file)
--- 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,
@@ -752,7 +753,9 @@ static struct argp_option options[] = {
       "Allowed signals are: SIGHUP, SIGQUIT, SIGINT, SIGUSR1 and SIGUSR2; "
       "the names without SIG prefix are also accepted"), GRID+1 },
   {"utc", UTC_OPTION, 0, 0,
-   N_("print file modification dates in UTC"), GRID+1 },
+   N_("print file modification times in UTC"), GRID+1 },
+  {"full-time", FULL_TIME_OPTION, 0, 0,
+   N_("print file time to its full 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;
This page took 0.032901 seconds and 4 git commands to generate.