fat和ntfs文件的时间转换为年月日的时间

客户突然说需要在项目上能显示完整的文件的时间属性, 比如最后修改时间.
NTFS的实现由于时间比较紧,就没有到网上找找看有没有已经实现的算法.如果谁知道有已经实现的算法的话请不吝告知啊.谢谢.

fat的就比较简单,在dir entry中,找到相关字段,进行以为操作即可,然后加上1980年的偏移就ok.

fno->fileinfo.year = (fno->fileinfo.fdate >> 9) + 1980;fno->fileinfo.month = (fno->fileinfo.fdate >> 5) & 15;fno->fileinfo.day = fno->fileinfo.fdate & 31;fno->fileinfo.hour = (fno->fileinfo.ftime >> 11);fno->fileinfo.minute = (fno->fileinfo.ftime >> 5) & 63,fno->fileinfo.second = (fno->fileinfo.ftime & 31) * 2;

下面是fat的white paper的内容:
Date and Time Formats
Many FAT file systems do not support Date/Time other than DIR_WrtTime and DIR_WrtDate.
For this reason, DIR_CrtTimeMil, DIR_CrtTime, DIR_CrtDate, and DIR_LstAccDate are actually optional fields.
DIR_WrtTime and DIR_WrtDate must be supported, however. If the other da


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部