Attachments (3)
Change History (11)
by , 14 years ago
Attachment: | r40230-2h_tracker_wrong_dates_on_ntfs.png added |
---|
by , 14 years ago
Attachment: | r40230-2h_terminal_wrong_dates_on_ntfs_volume.png added |
---|
by , 14 years ago
Attachment: | winxp_explorer_correct_dates.png added |
---|
comment:1 by , 14 years ago
Component: | - General → File Systems/NTFS |
---|---|
Owner: | changed from | to
comment:2 by , 14 years ago
follow-up: 6 comment:5 by , 14 years ago
The obvious bug is at the following lines in src/add-ons/kernel/file_systems/ntfs/fs_func.c in fs_rstat():
stbuf->st_atime = ni->last_access_time; stbuf->st_ctime = ni->last_mft_change_time; stbuf->st_mtime = ni->last_data_change_time;
st_atime, st_ctime, st_mtime are actually time_t
#define st_atime st_atim.tv_sec #define st_mtime st_mtim.tv_sec #define st_ctime st_ctim.tv_sec
The code should look like the following, unless I miss something. ntfs2timespec is available in ntfstime.h.
stbuf->st_atim = ntfs2timespec(ni->last_access_time); stbuf->st_mtim = ntfs2timespec(ni->last_data_change_time); stbuf->st_ctim = ntfs2timespec(ni->last_mft_change_time);
comment:6 by , 14 years ago
Replying to korli:
The code should look like the following, unless I miss something. ntfs2timespec is available in ntfstime.h.
stbuf->st_atim = ntfs2timespec(ni->last_access_time); stbuf->st_mtim = ntfs2timespec(ni->last_data_change_time); stbuf->st_ctim = ntfs2timespec(ni->last_mft_change_time);
Agreed. NTFS times seem to be in 1/10 microseconds with another base, so some kind of conversion is needed. And although ATM it is not strictly necessary to set the nanoseconds fields (the VFS clears them) the suggested solution also makes use of the additional precision, which is definitely the best thing to do.
I had this back in hrev40074.