diff options
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 9 |
1 files changed, 7 insertions, 2 deletions
| @@ -249,14 +249,19 @@ double mtime_nl(const char *fn, int *n_link) | |||
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | 251 | ||
| 252 | #define MIN(v1, v2) ((v1) < (v2) ? (v1) : (v2)) | ||
| 253 | |||
| 252 | double f_ctime(const char *fn) | 254 | double f_ctime(const char *fn) |
| 253 | /* returns the ctime of a file or directory, or 0.0 */ | 255 | /* returns the ctime of a file or directory, or 0.0 */ |
| 254 | { | 256 | { |
| 255 | struct stat st; | 257 | struct stat st; |
| 256 | double r = 0.0; | 258 | double r = 0.0; |
| 257 | 259 | ||
| 258 | if (fn && stat(fn, &st) != -1) | 260 | if (fn && stat(fn, &st) != -1) { |
| 259 | r = (double) st.st_ctim.tv_sec; | 261 | /* return the lowest of ctime and mtime; |
| 262 | there are operations that change the ctime, like link() */ | ||
| 263 | r = (double) MIN(st.st_ctim.tv_sec, st.st_mtim.tv_sec); | ||
| 264 | } | ||
| 260 | 265 | ||
| 261 | return r; | 266 | return r; |
| 262 | } | 267 | } |