summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-03-28 12:20:51 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-03-28 12:26:37 +0300
commitfc61c174100019859fc3ae930a18839cd316be6e (patch)
tree02e7e9d459c90c1f28449046b4cbbaa744c8e687
parent2981fcc5cbb63080f24f59570ea7fde8efc9bb34 (diff)
downloadtar-fc61c174100019859fc3ae930a18839cd316be6e.tar.gz
New option --full-time.
* 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.
-rw-r--r--NEWS17
-rw-r--r--doc/tar.texi24
-rw-r--r--src/common.h2
-rw-r--r--src/list.c2
-rw-r--r--src/tar.c9
5 files changed, 46 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 1d354146..c8d614df 100644
--- 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>
+* 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.
@@ -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 '/.'.
diff --git a/doc/tar.texi b/doc/tar.texi
index 9bca1ef7..ed93e579 100644
--- a/doc/tar.texi
+++ b/doc/tar.texi
@@ -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}
diff --git a/src/common.h b/src/common.h
index d2de528e..3b91f464 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;
+/* 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.
diff --git a/src/list.c b/src/list.c
index 0474fb1e..ac7c8fb2 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 b127963f..21c396d5 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,
@@ -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;