commit 93008cf

default  ·  2023-04-12 07:43:23 +0000 UTC
parent 889f319
New function f_ctime().
2 files changed,  +14, -0
M data.c
M snac.h
M data.c
+13, -0
 1@@ -249,6 +249,19 @@ double mtime_nl(const char *fn, int *n_link)
 2 }
 3 
 4 
 5+double f_ctime(const char *fn)
 6+/* returns the ctime of a file or directory, or 0.0 */
 7+{
 8+    struct stat st;
 9+    double r = 0.0;
10+
11+    if (fn && stat(fn, &st) != -1)
12+        r = (double) st.st_ctim.tv_sec;
13+
14+    return r;
15+}
16+
17+
18 /** database 2.1+ **/
19 
20 /** indexes **/
M snac.h
+1, -0
1@@ -60,6 +60,7 @@ void srv_archive_error(const char *prefix, const xs_str *err,
2 
3 double mtime_nl(const char *fn, int *n_link);
4 #define mtime(fn) mtime_nl(fn, NULL)
5+double f_ctime(const char *fn);
6 
7 int index_add(const char *fn, const char *md5);
8 int index_gc(const char *fn);