From owner-svn-src-projects@FreeBSD.ORG Thu Sep 20 23:00:02 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 406FD106566B; Thu, 20 Sep 2012 23:00:02 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DA4D8FC0A; Thu, 20 Sep 2012 23:00:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8KN01L1009623; Thu, 20 Sep 2012 23:00:01 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8KN01S8009620; Thu, 20 Sep 2012 23:00:01 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201209202300.q8KN01S8009620@svn.freebsd.org> From: Brooks Davis Date: Thu, 20 Sep 2012 23:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240767 - projects/mtree/contrib/mtree X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Sep 2012 23:00:02 -0000 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))