summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-08-01 13:57:28 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-08-01 13:57:28 +0200
commit7ca05341380434ae9e557d16d1ae88d133f0490c (patch)
tree80727cee5057edf257ab28da947643c5fbbe6f10 /apt-pkg/contrib
parentfc15861a405a0b0483bb8989e6a43215a86dba55 (diff)
parent77de0e831a12aedde05ff6bff8fb07dcbb4074ad (diff)
merged from lp:~mvo/apt/mvo
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/fileutl.cc11
-rw-r--r--apt-pkg/contrib/fileutl.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 50019872e..85dc6f600 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -446,6 +446,17 @@ string SafeGetCWD()
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 /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index cde288ad2..a1b177f38 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -97,6 +97,7 @@ bool FileExists(string File);
bool RealFileExists(string File);
bool DirectoryExists(string const &Path) __attrib_const;
bool CreateDirectory(string const &Parent, string const &Path);
+time_t GetModificationTime(string const &Path);
/** \brief Ensure the existence of the given Path
*