]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/fileutl.cc
* apt-pkg/contrib/fileutl.{cc,h}:
[apt.git] / apt-pkg / contrib / fileutl.cc
index 50019872e3d3e16fbe81df2698025644e5eac4b3..85dc6f6006a7ed963dd017459b8c19e65bf442ac 100644 (file)
@@ -446,6 +446,17 @@ string SafeGetCWD()
    return S;
 }
                                                                        /*}}}*/
    return S;
 }
                                                                        /*}}}*/
+// GetModificationTime - Get the mtime of the given file or -1 on error /*{{{*/
+// ---------------------------------------------------------------------
+/* We return / on failure. */
+time_t GetModificationTime(string const &Path)
+{
+   struct stat St;
+   if (stat(Path.c_str(), &St) < 0)
+      return -1;
+   return  St.st_mtime;
+}
+                                                                       /*}}}*/
 // flNotDir - Strip the directory from the filename                    /*{{{*/
 // ---------------------------------------------------------------------
 /* */
 // flNotDir - Strip the directory from the filename                    /*{{{*/
 // ---------------------------------------------------------------------
 /* */