Sunday, June 24, 2007

FAT Filesystem and Timestamp

I found an old friend of mine wrote an interesting article about FAT filesystem timestamp handling in Linux.

Summary (in Japanese) is here, and his points (in English) are:
  • Linux FAT filesystem implementation interprets timestamps as localtime where the kernel is running
  • Linux kernel gets timezone information from the user land via settimeofday() system call
  • The FAT filesystem translates the localtime timestamps into epoc (GMT) format on request of stat() system call.
  • ls command translates the epoc format timestamps derived via stat() system call into localtime format AGAIN! :o
Thanks JR0BAK for the interesting issue! :)


BTW, note that 'ctime' of POSIX is 'Change time' not 'Create time', thus in principle it's impossible to know when a file was created under general UNIX environment.

No comments: