RFC: Change mtree nsec handling?

Poul-Henning Kamp phk at phk.freebsd.dk
Fri Jan 30 02:10:16 PST 2009


In message <49829D49.10306 at freebsd.org>, Tim Kientzle writes:

>mtree support and the mtree(8) program, I found
>that mtree formats timestamps rather strangely.
>
>For example, a timestamp of 1233295862.000001
>(1233295682 seconds and 1000 nanoseconds)
>will be printed like this by mtree:
>    time=1233295862.1000
>Unsurprisingly, the mtree parsing works the same
>way in reverse.


>Index: spec.c
>===================================================================
>--- spec.c	(revision 187910)
>+++ spec.c	(working copy)
>@@ -172,6 +172,7 @@
> 	mode_t *m;
> 	int value;
> 	char *ep;
>+	int i;
> 
> 	for (; (kw = strtok(t, "= \t\n")); t = NULL) {
> 		ip->flags |= type = parsekey(kw, &value);
>@@ -258,6 +259,8 @@
> 				val = ep + 1;
> 				ip->st_mtimespec.tv_nsec
> 				    = strtoul(val, &ep, 10);
>+				for (i = ep - val; i < 9; ++i)
>+					ip->st_mtimespec.tv_nsec *= 10;

Why is this bit needed ?

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-current mailing list