I was trying different values for time granularity but did not get the results I expected, which I think is because of the function below: /** * timespec_trunc - Truncate timespec to a granularity * @t: Timespec * @gran: Granularity in ns. * * Truncate a timespec to a granularity. gran must be smaller than a second. * Always rounds down. * * This function should be only used for timestamps returned by * current_kernel_time() or CURRENT_TIME, not with do_gettimeofday() because * it doesn't handle the better resolution of the latter. */ struct timespec timespec_trunc(struct timespec t, unsigned gran) { /* * Division is pretty slow so avoid it for common cases. * Currently current_kernel_time() never returns better than * jiffies resolution. Exploit that. */ if (gran <= jiffies_to_usecs(1) * 1000) { /* nothing */ } else if (gran == 1000000000) { t.tv_nsec = 0; } else { t.tv_nsec -= t.tv_nsec % gran; } return t; } EXPORT_SYMBOL(timespec_trunc); The first condition gives no rounding, but although current_kernel_time() is only updated every jiffy, it is not rounded to that granularity. With HZ=250 and gran=1000000, I was expecting to see just 3 decimal places of time. But instead I get: # touch a # stat a File: `a' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: fc01h/64513d Inode: 65 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2008-04-09 17:05:38.032726306 +0300 Modify: 2008-04-09 17:05:38.032726306 +0300 Change: 2008-04-09 17:05:38.032726306 +0300 If I change gran to 10000000, it works: # touch a # stat a File: `a' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: fc01h/64513d Inode: 65 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2008-04-09 17:34:25.180000000 +0300 Modify: 2008-04-09 17:34:25.180000000 +0300 Change: 2008-04-09 17:34:25.180000000 +0300 Is this how it is meant to be? -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html