summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-12-10 20:03:49 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-12-10 20:03:49 +0100
commit76a763e1f842543a53bc28db681d963d0fc4ae12 (patch)
tree9e61f14bdfbce67ea001fe293497c6d9205f380e /apt-pkg/contrib/fileutl.cc
parent468720c59fcf48b20332cdb7b601b2b0d7cbbfbb (diff)
* apt-pkg/contrib/fileutl.{h,cc}:
- implement a ModificationTime method for FileFd
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 1cb3fab1e..83b68e796 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1106,6 +1106,20 @@ unsigned long long FileFd::Size()
return size;
}
/*}}}*/
+// FileFd::ModificationTime - Return the time of last touch /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+time_t FileFd::ModificationTime()
+{
+ struct stat Buf;
+ if (fstat(iFd,&Buf) != 0)
+ {
+ _error->Errno("fstat","Unable to determine the modification time of file %s", FileName.c_str());
+ return 0;
+ }
+ return Buf.st_mtime;
+}
+ /*}}}*/
// FileFd::Close - Close the file if the close flag is set /*{{{*/
// ---------------------------------------------------------------------
/* */