svn commit: r240767 - projects/mtree/contrib/mtree

Brooks Davis brooks at FreeBSD.org
Thu Sep 20 23:00:02 UTC 2012


Author: brooks
Date: Thu Sep 20 23:00:01 2012
New Revision: 240767
URL: http://svn.freebsd.org/changeset/base/240767

Log:
  Correctly format the nanoseconds by padding out to 9 digits.
  Document this with text from the FreeBSD manpage.
  
  Without this change a file modified on the first nanosecond of a second
  (N.000000001) would be reported to have been modified at precicely 100ms
  into the second (N.100000000).

Modified:
  projects/mtree/contrib/mtree/create.c
  projects/mtree/contrib/mtree/mtree.8
  projects/mtree/contrib/mtree/spec.c

Modified: projects/mtree/contrib/mtree/create.c
==============================================================================
--- projects/mtree/contrib/mtree/create.c	Thu Sep 20 22:56:11 2012	(r240766)
+++ projects/mtree/contrib/mtree/create.c	Thu Sep 20 23:00:01 2012	(r240767)
@@ -215,11 +215,11 @@ statf(int indent, FTSENT *p)
 		    (long long)p->fts_statp->st_size);
 	if (keys & F_TIME)
 #if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H)
-		output(indent, &offset, "time=%ld.%ld",
+		output(indent, &offset, "time=%ld.%09ld",
 		    (long)p->fts_statp->st_mtimespec.tv_sec,
 		    p->fts_statp->st_mtimespec.tv_nsec);
 #else
-		output(indent, &offset, "time=%ld.%ld",
+		output(indent, &offset, "time=%ld.%09ld",
 		    (long)p->fts_statp->st_mtime, (long)0);
 #endif
 	if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {

Modified: projects/mtree/contrib/mtree/mtree.8
==============================================================================
--- projects/mtree/contrib/mtree/mtree.8	Thu Sep 20 22:56:11 2012	(r240766)
+++ projects/mtree/contrib/mtree/mtree.8	Thu Sep 20 23:00:01 2012	(r240767)
@@ -492,7 +492,10 @@ and
 These may be specified without leading or trailing commas, but will be
 stored internally with them.
 .It Sy time
-The last modification time of the file.
+The last modification time of the file,
+in second and nanoseconds.
+The value should include a period character and exactly nine digits after
+the period.
 .It Sy type
 The type of the file; may be set to any one of the following:
 .Pp

Modified: projects/mtree/contrib/mtree/spec.c
==============================================================================
--- projects/mtree/contrib/mtree/spec.c	Thu Sep 20 22:56:11 2012	(r240766)
+++ projects/mtree/contrib/mtree/spec.c	Thu Sep 20 23:00:01 2012	(r240767)
@@ -358,7 +358,7 @@ dump_nodes(const char *dir, NODE *root, 
 		if (MATCHFLAG(F_SIZE))
 			appendfield(pathlast, "size=%lld", (long long)cur->st_size);
 		if (MATCHFLAG(F_TIME))
-			appendfield(pathlast, "time=%lld.%ld",
+			appendfield(pathlast, "time=%lld.%09ld",
 			    (long long)cur->st_mtimespec.tv_sec,
 			    cur->st_mtimespec.tv_nsec);
 		if (MATCHFLAG(F_CKSUM))


More information about the svn-src-projects mailing list