Determining file creation order when created in same second

In a UNIX file system, given two or more files created in the same second (located in the same folder), how do you determine which file was created first?  That is, the stat structure's st_mtime/st_ctime values are exactly the same for all files.  How do you determine the order that they were created in?
sradcliffeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ahoffmannConnect With a Mentor Commented:
check the stat struct, some versions support
  long     st_mtimensec;
beside
  struct timespec st_mtimespec;
or timespec has an item
  long    tv_nsec;    /* and nanoseconds */

NOTE that both is non-POSIX, so you need to undef corresponding POSIX compiler defines

unfortunately, if you need to break down to nanoseconds, see maxkir's answer ;-)
0
 
sradcliffeAuthor Commented:
Edited text of question.
0
 
maxkirCommented:
Impossible ...
0
 
sradcliffeAuthor Commented:
The tv_nsec is exactly what I needed. Thanks.
0
All Courses

From novice to tech pro — start learning today.