[llvm-commits] CVS: llvm/lib/Support/FileUtilities.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Dec 31 00:16:02 PST 2003
Changes in directory llvm/lib/Support:
FileUtilities.cpp updated: 1.18 -> 1.19
---
Log message:
Add new function
---
Diffs of the changes: (+13 -0)
Index: llvm/lib/Support/FileUtilities.cpp
diff -u llvm/lib/Support/FileUtilities.cpp:1.18 llvm/lib/Support/FileUtilities.cpp:1.19
--- llvm/lib/Support/FileUtilities.cpp:1.18 Tue Dec 30 01:36:14 2003
+++ llvm/lib/Support/FileUtilities.cpp Wed Dec 31 00:15:37 2003
@@ -204,6 +204,19 @@
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
More information about the llvm-commits
mailing list