TONT 40473 为什么将文件复制到软盘时,文件的时间戳会改变?

时区?时区是什么东西?

原文链接:https://blogs.msdn.microsoft.com/oldnewthing/20040226-00/?p=40473

Floppy disks use the FAT filesystem, as do DOS-based and Windows 95-based operating systems. On the other hand, Windows NT-based systems (Windows 2000, XP, 2003, …) tend to use the NTFS filesystem. (Although you can format a drive as FAT on Windows NT-based systems, it is not the default option.)

软盘使用的是FAT文件系统,这一点上基于DOS和Windows 95的操作系统也是一样的。另一方面,基于Windows NT的系统(Windows 2000、XP、2003……)倾向于使用NTFS文件系统。(尽管你也可以在基于NT的系统上将磁盘格式化为FAT文件系统,但这不是默认选项。)

The NTFS and FAT filesystems store times and dates differently. Note, for example, that FAT records last-write time only to two-second accuracy. So if you copy a file from NTFS to FAT, the last-write time can change by as much as two seconds.

NTFS和FAT这两种文件系统保存时间和日期的方式是不同的。需要注意的点,包括如FAT文件系统记录文件的最后修改时间精确度有2秒的许可误差。所以如果你将一个文件从NTFS文件系统复制到FAT文件系统中,则该文件的最后修改时间最多会有2秒的差异。

Why is FAT so much lamer than NTFS? Because FAT was invented in 1977, back before people were worried about such piddling things like time zones, much less Unicode. And it was still a major improvement over CP/M, which didn’t have timestamps at all.

为什么FAT比NTFS弱那么多?因为FAT是1977年研发的,那时候人们根本不在乎时区之类的事情,就更别提Unicode什么的。即使如此FAT仍然比CP/M(的文件系统)是巨大的进步,后者连文件的时间戳信息都没有。

It is also valuable to read and understand the consequences of FAT storing filetimes in local time, compared to NTFS storing filetimes in UTC. In addition to the Daylight Savings time problems, you also will notice that the timestamp will appear to change if you take a floppy across timezones. Create a file at, say, 9am Pacific time, on a floppy disk. Now move the floppy disk to Mountain time. The file was created at 10am Mountain time, but if you look at the disk it will still say 9am, which corresponds to 8am Pacific time. The file travelled backwards in time one hour. (In other words, the timestamp failed to change when it should.)

阅读并了解FAT文件系统采用本地时间、而不像NTFS文件系统那样采用UTC时间存储文件的各种时间也是很有价值的。除了有关夏时制的问题之外,你还会注意到如果将软盘跨时区携带的话,文件的时间戳看上去好像会发生改变。(例如,)在软盘上创建一个文件,时间是美国西部标准时间(Pacific time)(译注:UTC-8)早上9点。然后将这张软盘带到(使用)山区时间(Mountain time)(的时区)(译注:UTC-7),那么这个文件理论上应当是在山区时间早上10点创建的,但如果看磁盘上的时间的话,仍然会显示为早上9点,而这等同于美国西部标准时间的早上8点。这个文件向前穿越了一个小时。(换句话说,时间戳本应该改变,但却没有。)

Comments

发表评论

电子邮件地址不会被公开。 必填项已用*标注

 剩余字数 ( Characters available )

注:请不要在评论中插入任何链接,否则将自动被识别为垃圾评论,博主将完全看不到。

Notice: please DO NOT add any links in your comment, otherwise it would be identified as SPAM automatically.

*