Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

S-trace
Copy link

@S-trace S-trace commented Jul 7, 2019

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
Copy link

jbruchon commented Jul 7, 2019

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.

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 accept pointer
to struct timespec and fill it from timestamp from stat() output.

If stat() failed - fill timespec to 0.0
@S-trace
Copy link
Author

S-trace commented Nov 2, 2022

Should be fixed by 8b223d6

@S-trace S-trace closed this Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants