diff options
| author | 2023-04-12 09:43:23 +0200 | |
|---|---|---|
| committer | 2023-04-12 09:43:23 +0200 | |
| commit | 93008cfc3e60b09e12fc3e1220602cab3a40b652 (patch) | |
| tree | fe11fa031804c83c19d51418cf5e3c63266e70df | |
| parent | Commented out debugging messages. (diff) | |
| download | penes-snac2-93008cfc3e60b09e12fc3e1220602cab3a40b652.tar.gz penes-snac2-93008cfc3e60b09e12fc3e1220602cab3a40b652.tar.xz penes-snac2-93008cfc3e60b09e12fc3e1220602cab3a40b652.zip | |
New function f_ctime().
| -rw-r--r-- | data.c | 13 | ||||
| -rw-r--r-- | snac.h | 1 |
2 files changed, 14 insertions, 0 deletions
| @@ -249,6 +249,19 @@ double mtime_nl(const char *fn, int *n_link) | |||
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | 251 | ||
| 252 | double f_ctime(const char *fn) | ||
| 253 | /* returns the ctime of a file or directory, or 0.0 */ | ||
| 254 | { | ||
| 255 | struct stat st; | ||
| 256 | double r = 0.0; | ||
| 257 | |||
| 258 | if (fn && stat(fn, &st) != -1) | ||
| 259 | r = (double) st.st_ctim.tv_sec; | ||
| 260 | |||
| 261 | return r; | ||
| 262 | } | ||
| 263 | |||
| 264 | |||
| 252 | /** database 2.1+ **/ | 265 | /** database 2.1+ **/ |
| 253 | 266 | ||
| 254 | /** indexes **/ | 267 | /** indexes **/ |
| @@ -60,6 +60,7 @@ void srv_archive_error(const char *prefix, const xs_str *err, | |||
| 60 | 60 | ||
| 61 | double mtime_nl(const char *fn, int *n_link); | 61 | double mtime_nl(const char *fn, int *n_link); |
| 62 | #define mtime(fn) mtime_nl(fn, NULL) | 62 | #define mtime(fn) mtime_nl(fn, NULL) |
| 63 | double f_ctime(const char *fn); | ||
| 63 | 64 | ||
| 64 | int index_add(const char *fn, const char *md5); | 65 | int index_add(const char *fn, const char *md5); |
| 65 | int index_gc(const char *fn); | 66 | int index_gc(const char *fn); |