aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-12-31 06:15:37 +0000
committerChris Lattner <sabre@nondot.org>2003-12-31 06:15:37 +0000
commit81a085a2598a877a02dbedf9d91e7bf899fb2f02 (patch)
tree606372fd684bf762f2339a3345d751755a4cdd47 /lib
parentcf902777e9ddb5bbb806b11efcf8c14638fe779d (diff)
downloadexternal_llvm-81a085a2598a877a02dbedf9d91e7bf899fb2f02.zip
external_llvm-81a085a2598a877a02dbedf9d91e7bf899fb2f02.tar.gz
external_llvm-81a085a2598a877a02dbedf9d91e7bf899fb2f02.tar.bz2
Add new function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10664 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Support/FileUtilities.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Support/FileUtilities.cpp b/lib/Support/FileUtilities.cpp
index 04b8c61..1b8df43 100644
--- a/lib/Support/FileUtilities.cpp
+++ b/lib/Support/FileUtilities.cpp
@@ -204,6 +204,19 @@ long long llvm::getFileSize(const std::string &Filename) {
return StatBuf.st_size;
}
+/// getFileTimestamp - Get the last modified time for the specified file in an
+/// unspecified format. This is useful to allow checking to see if a file was
+/// updated since that last time the timestampt was aquired. If the file does
+/// not exist or there is an error getting the time-stamp, zero is returned.
+unsigned long long llvm::getFileTimestamp(const std::string &Filename) {
+ struct stat StatBuf;
+ if (stat(Filename.c_str(), &StatBuf) == -1)
+ return 0;
+ return StatBuf.st_mtime;
+}
+
+
+
//===----------------------------------------------------------------------===//
// FDHandle class implementation