views:

55

answers:

1

Linux friends, how do you guys get a file timestamp in the resolution of milliseconds in Ubuntu? When I tried the command "stat" on my system, I get:

 File: `tmp.dat'
  Size: 14              Blocks: 8          IO Block: 4096   regular file
Device: 811h/2065d      Inode: 13895454    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    yqin)   Gid: ( 1004/     dev)
Access: 2010-09-27 09:04:44.000000000 -0400
Modify: 2010-09-25 13:54:58.000000000 -0400
Change: 2010-09-25 13:54:58.000000000 -0400

It seems that the resolution is only up to second. Any ideas? Thanks a lot.

+1  A: 

That depends on the filesystem. fat will give you 2 second resolution. ext2 and ext3 are based on seconds. ext4 has nanoseconds (http://www.softpanorama.org/Internals/Filesystems/linux_ext2_ext3.shtml, search for "minimum timestamp resolution").

Aaron Digulla
Thanks. I have ext3 file system. I tried another computer with the same file system but has a RedHat Enterprise OS, and it had the resolution up to microseconds... Is this a configuration issue that I can change? Thanks again
Just replace "ext3" with "ext4" in `/etc/fstab` and reboot. Then you should get nanoseconds.
Aaron Digulla