adrianlopezroche / fdupes

FDUPES is a program for identifying or deleting duplicate files residing within specified directories.
2.43k stars 187 forks source link

Use nanosecond-precision timestamps to compare atimes and mtimes #122

Closed S-trace closed 1 year ago

S-trace commented 5 years ago

Add int is_first_timespec_newer(struct timespec first, struct timespec second).

Change time_t sorttime to struct timespec sorttimespec.

Change getmtime(char filename) and getctime(char filename) to return pointer to newly allocated struct timespec (must be passed to free() after use).

jbruchon commented 5 years ago

This breaks cross-platform compatibility; on macOS, there is no struct timespec st_mtim; it's called struct timespec st_mtimespec instead. fdupes isn't ported to Windows but if it ever was, on MinGW compilters, there is no struct timespec in sys/stat.h. On NetBSD there is a fall-through that defines the nanosecond field as long st_mtimensec instead of using struct timespec st_mtim.

S-trace commented 1 year ago

Should be fixed by https://github.com/adrianlopezroche/fdupes/commit/8b223d6a2037b6c28d4c00b60dbc9d359309c07f