summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-04-12 09:43:23 +0200
committerGravatar default2023-04-12 09:43:23 +0200
commit93008cfc3e60b09e12fc3e1220602cab3a40b652 (patch)
treefe11fa031804c83c19d51418cf5e3c63266e70df
parentCommented out debugging messages. (diff)
downloadpenes-snac2-93008cfc3e60b09e12fc3e1220602cab3a40b652.tar.gz
penes-snac2-93008cfc3e60b09e12fc3e1220602cab3a40b652.tar.xz
penes-snac2-93008cfc3e60b09e12fc3e1220602cab3a40b652.zip
New function f_ctime().
-rw-r--r--data.c13
-rw-r--r--snac.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/data.c b/data.c
index 50a484f..96ec7f0 100644
--- a/data.c
+++ b/data.c
@@ -249,6 +249,19 @@ double mtime_nl(const char *fn, int *n_link)
249} 249}
250 250
251 251
252double 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 **/
diff --git a/snac.h b/snac.h
index 6cd16d4..570f5cc 100644
--- a/snac.h
+++ b/snac.h
@@ -60,6 +60,7 @@ void srv_archive_error(const char *prefix, const xs_str *err,
60 60
61double mtime_nl(const char *fn, int *n_link); 61double mtime_nl(const char *fn, int *n_link);
62#define mtime(fn) mtime_nl(fn, NULL) 62#define mtime(fn) mtime_nl(fn, NULL)
63double f_ctime(const char *fn);
63 64
64int index_add(const char *fn, const char *md5); 65int index_add(const char *fn, const char *md5);
65int index_gc(const char *fn); 66int index_gc(const char *fn);