Is there a way to get the creation time of a file in windows in a higher accuracy? I want to get the creation time of an mp4-video in milliseconds. Is this possible?
The creation timestamp of a file in windows depends on the file system:
FAT/VFAT has a maximum resolution of 2s
NTFS has a maximum resolution of 100 ns
You can use
wmic to retrieve the file creation date to the nearest microsecond.
F:\test>wmic datafile where name="f:\\test\\test.txt" get creationdate | findstr /brc:[0-9] 20150329221650.080654+060
20150329221650.080654+060 is a timestamp, with the following format:
yyyyFour-digit year (0000 through 9999).
mmTwo-digit month (01 through 12).
ddTwo-digit day of the month (01 through 31).
HHTwo-digit hour of the day using the 24-hour clock (00 through 23).
MMTwo-digit minute in the hour (00 through 59).
SSTwo-digit number of seconds in the minute (00 through 59).
xxxxxxSix-digit number of microseconds in the second (000000 through 999999)
sPlus sign (
+) or minus sign (
-) to indicate a positive or negative offset from Coordinated Universal Times (UTC).
UUUThree-digit offset indicating the number of minutes that the originating time zone deviates from UTC.
DavidPostill@Hal /f/test $ stat test.txt | grep Birth Birth: 2015-03-29 22:16:50.080654200 +0100
dir output for comparison
F:\test>dir /t:c test.txt Volume in drive F is Expansion Volume Serial Number is 3656-BB63 Directory of F:\test 29/03/2015 22:16 32 test.txt 1 File(s) 32 bytes 0 Dir(s) 1,798,546,849,792 bytes free
A clever way is demonstrated here: https://stackoverflow.com/questions/5180592/showing-ntfs-timestamp-with-100-nsec-granularity
It's using VBScript to query WMI's CIM database and return the
FILETIME structure associated to a file.
There are also open source tools that can inspect a media file's metadata, such as EXIFtool which is geared towards managing the metadata of media created by digital cameras.
It depends on the file system: FAT has 2 second resolution, NTFS theoretically has 100 ns resolution, but the actual resolution is 10 ms. That said, interrupts have higher priority than disk I/O, and I'm not sure the effect write-caching has on the time stamp. Multimedia timers are optimized for accuracy, so would be the preferred way to implement timing.
You can use an existing tool such as XYplorer to view high-resolution timestamps, or , you may prefer to write your own application. Use the File.GetCreationTime Method; it returns a DateTime Structure with Millisecond property.