Results 1 to 4 of 4
I need the 'last access time' of a file in microseconds .
Struct stat returns the time in seconds . Is there any other way to get access/modified time of ...
- 04-22-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 3
[SOLVED] file properties - last access/modified time
I need the 'last access time' of a file in microseconds.
Struct stat returns the time in seconds. Is there any other way to get access/modified time of files?
struct stat sb;
if(stat(filename.c_str(), &sb) != -1)
{
time_t accesTime = sb.st_atime; //accessTime in seconds
...some code...
}
- 04-22-2010 #2
If I'm not wrong,ext3 file system saves timestamps in seconds - Only ext4 saves timestamp in nano seconds.
If you need ext3 timestamp in other format , you can convert it (from seconds to micro/nano seconds ) manually in your code.- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 04-22-2010 #3Just Joined!
- Join Date
- Mar 2010
- Posts
- 3
Thanks for your reply.
I have some files which have same 'access time' in seconds. If I read those times in seconds and convert it manually to microseconds (seconds*pow (10,6)), I'll get the same access time for all files again.
I wanted to read the access time more precisely.
- 04-22-2010 #4
Again , I'm not wrong
you can't achieve your requirement with ext3 file system. May be you can check all timestamps like ctime and mtime and combine to them to get results - if that's not suitable to your program,you need to go for file systems that supports micro/nano timestamp.
HTH- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------



