{"id":83,"date":"2014-09-03T07:00:00","date_gmt":"2014-09-03T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2014\/09\/03\/why-does-the-timestamp-of-a-file-increase-by-up-to-2-seconds-when-i-copy-it-to-a-usb-thumb-drive\/"},"modified":"2014-09-03T07:00:00","modified_gmt":"2014-09-03T07:00:00","slug":"why-does-the-timestamp-of-a-file-increase-by-up-to-2-seconds-when-i-copy-it-to-a-usb-thumb-drive","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20140903-00\/?p=83","title":{"rendered":"Why does the timestamp of a file increase by up to 2 seconds when I copy it to a USB thumb drive?"},"content":{"rendered":"<p>\nWe saw some time ago that\n<a HREF=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2004\/02\/26\/80492.aspx\">\nthe FAT file system records timestamps in local time\nto only two-second resolution<\/a>.\nThis means that copying a file to a FAT-formatted device\n(typically a floppy drive or a USB thumb drive)\n<a HREF=\"http:\/\/support.microsoft.com\/kb\/127830\">\ncan increase the timestamp by up two seconds<\/a>.\nAnd even after the file is copied, the timestamp is not stable.\nThe timestamp changes depending on the time zone employed\nby the computer that accesses the drive.\nIn particular,\nif you are in a part of the world which changes clocks during\nthe summer,\nthen the timestamp on the file moves by an hour every spring\nand then moves in the opposite direction every autumn.\n(Because you change time zones twice a year.)\n<\/p>\n<p>\nOkay, but why does the timestamp always <i>increase<\/i>\nto the nearest two-second interval?\nWhy not round to the <i>nearest<\/i> two-second interval?\nThat way, the timestamp change is at most one second.\n<\/p>\n<p>\nBecause rounding to the nearest interval means that the file\nmight go backward in time,\nand that creates its own problems.\n(Causality can be such a drag.)\n<\/p>\n<p>\nFor example, suppose you regularly back up files from your\nNTFS-formatted C: drive to your USB thumb drive mounted as drive F:\nby typing<\/p>\n<pre>\nxcopy \/D C:\\Files\\* F:\\Files\\*\n<\/pre>\n<p>\nIf the timestamps rounded to the nearest two-second interval,\nthen half the files on average will have a timestamp on the USB\nthumb drive older than the files on the C: drive.\nThis means that if you perform the command a second time,\napproximately half of the files will be copied <i>again<\/i>.\nTo the user, it looks like the <code>xcopy<\/code> command\n<i>never finishes the job<\/i>,\nbecause each time you tell it &#8220;Perform an incremental backup&#8221;\nit always finds something to copy.\nIt never says, &#8220;All files up to date, you can go home now.&#8221;\n<\/p>\n<p>\nTo avoid this infinite loop, the convention is always to round <i>up<\/i>,\nso that the copy of a file is never older than the original.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We saw some time ago that the FAT file system records timestamps in local time to only two-second resolution. This means that copying a file to a FAT-formatted device (typically a floppy drive or a USB thumb drive) can increase the timestamp by up two seconds. And even after the file is copied, the timestamp [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[104],"class_list":["post-83","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-tipssupport"],"acf":[],"blog_post_summary":"<p>We saw some time ago that the FAT file system records timestamps in local time to only two-second resolution. This means that copying a file to a FAT-formatted device (typically a floppy drive or a USB thumb drive) can increase the timestamp by up two seconds. And even after the file is copied, the timestamp [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/83","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=83"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/83\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}