What is the precision of *.datenum, which dir() returns
Mostra commenti meno recenti
When I apply dir() to a file I get a struct with folder, name, date, bytes, and also datenum. How many significant digits do I need to fully store the number correctly, e.g., when I need to compare two files...
Say I print the number to an ascii file: fprintf(fid,'%.xf',mystruct.datenum) what is x supposed to be?
Risposte (2)
dpb
il 7 Mag 2018
1 voto
datenum is a double; hence has 15-16 significant digits; the safest way to store it is as a double but you'll get as close as can with '%.16g'
1 Commento
Walter Roberson
il 7 Mag 2018
Since it is a double, use num2hex() to convert it to hex.
The precision of the date depends on the file system. Linux' ext4 file system supports nanoseconds, NTFS uses 100 nanoseconds, FAT has a resolution of 2 seconds.
T = GetFileTime(FileName, 'native')
T.Write
>> 131499596832223845
Using this integer avoids rounding and precision problems of the doubles used for Matlab's datenum format.
Categorie
Scopri di più su Time Series Objects in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!