summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
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
commite866d1183b84007e28e084f3691a2317d130d0b8 (patch)
treef88e91272548b00b725325a68ddd23beea014b53 /llvm/lib/Support
parentef927f0ef25f0aff272dd9ffeaa7e65df975d5b7 (diff)
downloadbcm5719-llvm-e866d1183b84007e28e084f3691a2317d130d0b8.tar.gz
bcm5719-llvm-e866d1183b84007e28e084f3691a2317d130d0b8.zip
Add new function
llvm-svn: 10664
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/FileUtilities.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Support/FileUtilities.cpp b/llvm/lib/Support/FileUtilities.cpp
index 04b8c610a27..1b8df43629a 100644
--- a/llvm/lib/Support/FileUtilities.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud