Hi Martin,
You should get all information you need from the "readdir" already, you do not need to call "stat" for each file.
According to the Linux manual page at
https://man7.org/linux/man-pages/man3/readdir.3.html, the glibc implementation of readdir doesn't necessarily return modification time:
In the glibc implementation, the dirent structure is defined as follows:
struct dirent {
ino_t d_ino; /* Inode number */
off_t d_off; /* Not an offset; see below */
unsigned short d_reclen; /* Length of this record */
unsigned char d_type; /* Type of file; not supported by all filesystem types */
char d_name[256]; /* Null-terminated filename */
};
The only fields in the dirent structure that are mandated by POSIX.1 are d_name
and d_ino. The other fields are unstandardized, and not present on all systems.
What am I missing?
Dan