> It seems that the part that's not returning nanosecond is in the code > below. I've modified it, and now stat() is returning st_mtim.tv_nsec > correctly. > > I've tested it on ext2 and reiserfs, and both seems to be working. > > > I don't know why "t.tv_nsec = 0;" was set in the code. Any idea?
The first hunk doesn't make any sense. stime() will never know anything about nanoseconds. You're just putting uninitialized memory in there. The truncation you removed in the second was deliberately added for the old file systems that don't support higher granuality *times. Otherwise the time can jump backwards between a inode that is still cached in memory and one that is saved/restored from disk. Several programs (including make) assume this cannot happen, so the kernel prevents it by always rounding. If you want ns resolution you need a file system that supports it: that's currently XFS, JFS, NTFS/CIFS (resolution is lower, but < 1s), NFSv[34], UDF, with suitable servers, tmpfs/ramfs/hugetlbfs. ext4 ns support is being worked on, BTW the real max resolution supported in the kernel right now is jiffies. -Andi - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/