libntfs_ext library compilation with cellsdk

@bguerville, @aldostools, @deank, @Zar

There was an issue with folders/files time attributes.

I made some debugging and i found that the values of st_atime, st_ctime and st_mtime are set to NTFS time.
NTFS time = "NTFS stores times in a sle64 as the number of 100ns intervals since January 1st 1601 at 00:00 UTC"

Here's a log to clarify this:

Code:
File/folder attributes:
- last_access_time = -845557247
- last_mft_change_time = -845557247
- last_data_change_time = -845557247

----------------------------------------------------------

Some debugging:
now.tv_sec = 1489171246 // number of seconds since 1970
timespec2ntfs = -845557247 // unix time converted to ntfs time
ntfs2timespec = 1489171246 // ntfs time converted to unix time

So to convert this timestamps to unix time i replace those lines in ntfsinternal.c :

Code:
st->st_atime = ni->last_access_time;
st->st_ctime = ni->last_mft_change_time;
st->st_mtime = ni->last_data_change_time;

By:

Code:
struct timespec ts;

ts = ntfs2timespec(ni->last_access_time);
st->st_atime = ts.tv_sec;
ts = ntfs2timespec(ni->last_mft_change_time);
st->st_ctime = ts.tv_sec;
ts = ntfs2timespec(ni->last_data_change_time);
st->st_mtime = ts.tv_sec;

Now ps3ntfs_stat(), ps3ntfs_fstat() and ps3ntfs_dirnext() have correct Unix timestamps instead of NTFS time.
 
Nice work, freddy, thank you! I'll test it tomorrow and will recompile the prx library if necessary.
I just tested it right now, and it works like you can see it.
IMG_20170310_212309.jpg
 

Similar threads

Back
Top