فهرست منبع

New function f_ctime().

default 3 سال پیش
والد
کامیت
93008cfc3e
2فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 13 0
      data.c
  2. 1 0
      snac.h

+ 13 - 0
data.c

@@ -249,6 +249,19 @@ double mtime_nl(const char *fn, int *n_link)
 }
 
 
+double f_ctime(const char *fn)
+/* returns the ctime of a file or directory, or 0.0 */
+{
+    struct stat st;
+    double r = 0.0;
+
+    if (fn && stat(fn, &st) != -1)
+        r = (double) st.st_ctim.tv_sec;
+
+    return r;
+}
+
+
 /** database 2.1+ **/
 
 /** indexes **/

+ 1 - 0
snac.h

@@ -60,6 +60,7 @@ void srv_archive_error(const char *prefix, const xs_str *err,
 
 double mtime_nl(const char *fn, int *n_link);
 #define mtime(fn) mtime_nl(fn, NULL)
+double f_ctime(const char *fn);
 
 int index_add(const char *fn, const char *md5);
 int index_gc(const char *fn);