Thanks for your reply.
I guessed timestamp truncation may be because of some reasons for UDF specification, but now I understand it was not.
It seems to be correct, but let me show the way to get a little more precisive timestamp.
#include <windows.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
SYSTEMTIME SystemTime;
FILETIME CreationTime, LastAccessTime, LastWriteTime;
int Centiseconds;
ULARGE_INTEGER uli;
HANDLE h = CreateFile(L"foo", 0, 0, NULL, CREATE_ALWAYS, 0, NULL);
GetFileTime(h, &CreationTime, &LastAccessTime, &LastWriteTime);
FileTimeToSystemTime(&LastWriteTime, &SystemTime);
printf("A: Centiseconds: %d\n", (Centiseconds = SystemTime.wMilliseconds / 10));
printf("A: HundredsofMicroseconds: %d\n", (SystemTime.wMilliseconds - (Centiseconds * 10)) * 10);
printf("A: Microseconds: %d\n", 0);
uli.LowPart = LastWriteTime.dwLowDateTime;
uli.HighPart = LastWriteTime.dwHighDateTime;
printf("B: Centiseconds: %d\n", (uli.QuadPart / 100000) % 100);
printf("B: HundredsofMicroseconds: %d\n", (uli.QuadPart / 1000) % 100);
printf("B: Microseconds: %d\n", (uli.QuadPart / 10) % 100);
CloseHandle(h);
return 0;
}
The result of above code is here.
<command prompt>
C:\Data\Make\Programs\test_nanosecond\Debug>test_nanosecond.exe
A: Centiseconds: 71
A: HundredsofMicroseconds: 80
A: Microseconds: 0
B: Centiseconds: 71
B: HundredsofMicroseconds: 87
B: Microseconds: 50
<cygwin bash shell>
$ ls --full-time foo
-rwx------+ 1 yllLiBe なし(*) 0 2011-01-05 23:17:55.718750000 +0900 foo
(*): means `no group' in English.
Case A is the way you've written above.
It uses FileTimeToSystemTime() to get a value of milliseconds.
Case B is the way to use the FILETIME structure directly which has 100-nanosecond intervals. [MSDN]
This can get a little more precisive value of timestamp.
FYI, timestamp tick looks like 0.000125 sec (= 125 microseconds) in my environment actually.
I can see the time such as HH:MM:SS.mmm125000 and HH:MM:SS.mmm750000 by `ls --full-time', but I can't see HH:MM:SS.mmm100000 and HH:MM:SS.mmm200000.
Could you consider to change timestamp conversion more precise in the next update?
Sincerely yours.