From hburch@lumeta.com  Fri Jan 17 12:53:55 2003
Return-Path: <hburch@lumeta.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1E2A037B401
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Jan 2003 12:53:55 -0800 (PST)
Received: from exgw2.lumeta.com (exgw2.lumeta.com [65.198.68.66])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E30EB43E4A
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Jan 2003 12:53:53 -0800 (PST)
	(envelope-from hburch@lumeta.com)
Received: from lucy.corp.lumeta.com (h65-198-68-133.lumeta.com [65.198.68.133])
	by exgw2.lumeta.com (Postfix) with ESMTP id B93D237385E
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Jan 2003 15:53:52 -0500 (EST)
Received: from localhost (localhost [127.0.0.1])
	by lucy.corp.lumeta.com (Postfix) with ESMTP id 3F8E110844
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Jan 2003 15:53:52 -0500 (EST)
Received: from hburch.corp.lumeta.com (hburch.corp.lumeta.com [65.198.68.240])
	by lucy.corp.lumeta.com (Postfix) with ESMTP id 02B1E1083C
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Jan 2003 15:53:51 -0500 (EST)
Received: by hburch.corp.lumeta.com (Postfix, from userid 2007)
	id 6118B5E3; Fri, 17 Jan 2003 15:53:46 -0500 (EST)
Message-Id: <20030117205346.6118B5E3@hburch.corp.lumeta.com>
Date: Fri, 17 Jan 2003 15:53:46 -0500 (EST)
From: Hal Burch <hburch@lumeta.com>
Reply-To: Hal Burch <hburch@lumeta.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: st_*timespec tv_nsec zero on file creation
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         47168
>Category:       kern
>Synopsis:       st_*timespec tv_nsec zero on file creation
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 17 13:00:22 PST 2003
>Closed-Date:    Fri Jun 13 18:22:04 PDT 2003
>Last-Modified:  Fri Jun 13 18:22:04 PDT 2003
>Originator:     Hal Burch
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
>Environment:
System: FreeBSD hburch.corp.lumeta.com 4.7-STABLE FreeBSD 4.7-STABLE #1: Thu Oct 17 10:07:42 EDT 2002 root@hburch.corp.lumeta.com:/usr/obj/usr/src/sys/LOCAL i386
>Description:
tv_nsec in st_atimespec, st_mtimespec, and st_ctimespec are all zero
after most system calls.
>How-To-Repeat:
stat-ing code:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

int main(int argc, char **argv) {
	struct stat sb;
	if (argc < 2) { fprintf (stderr, "No args\n"); exit(1); }
	if (stat(argv[1], &sb) < 0) { perror("stat"); exit(1); }
	fprintf (stdout, "%i.%09i\n", 
		sb.st_atimespec.tv_sec, sb.st_atimespec.tv_nsec);
}

$ rm -f a; touch a; ./dostat a
1042836075.000000000
$ rm -f a; touch a; ./dostat a
1042836079.000000000
$ cat a; ./dostat a
1042836123.000000000
$ rm a; >a; ./dostat a
1042836191.000000000
>Fix:
I'm not familiar enough with the kernel tree to figure out where this
system times are being set.  This may also be expected behavior.
>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: Hal Burch <hburch@lumeta.com>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/47168: st_*timespec tv_nsec zero on file creation
Date: Sat, 18 Jan 2003 10:28:02 +1100 (EST)

 On Fri, 17 Jan 2003, Hal Burch wrote:
 
 > >Synopsis:       st_*timespec tv_nsec zero on file creation
 > ...
 > >Fix:
 > I'm not familiar enough with the kernel tree to figure out where this
 > system times are being set.  This may also be expected behavior.
 
 This is the expected behaviour.  ffs timestamps always have a zero tv_nsec
 unless you use a nonstandard setting of the vfs.timestamp_precision to
 get a higher precision.
 
 Caveats:
 - the sysctl is supposed to affect all filesystems.
 - some filesystems can't support nsec resolution.
 - some filesystems that could support it don't.
 - copying and archiving utilities can't support full nsec resolution, since
   there is no syscall to set it.  utimes() sets times in usec.
 - some copying and archiving utilities that could support usec resolution
   don't.
 
 Bruce
 
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Fri Jun 13 18:17:53 PDT 2003 
State-Changed-Why:  
The submitter is happy with my explanation of the behaviour 
(the vfs.timestamp_precision sysctl can be used to change it if 
desired). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=47168 
>Unformatted:
