From 2ec858bc68bc2d79ec020fe24be2d76b7c5b6792 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 28 Jul 2011 15:16:18 +0200 Subject: * apt-pkg/contrib/fileutl.{cc,h}: - add GetModificationTime() helper * apt-pkg/pkgcachegen.cc: - regenerate the cache if the sources.list changes to ensure that changes in the ordering there will be honored by apt * apt-pkg/sourcelist.{cc,h}: - add pkgSourceList::GetLastModifiedTime() helper --- apt-pkg/contrib/fileutl.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'apt-pkg/contrib/fileutl.cc') 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 /*{{{*/ // --------------------------------------------------------------------- /* */ -- cgit v1.2.3