aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CachePruning.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/CachePruning.cpp')
-rw-r--r--llvm/lib/Support/CachePruning.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Support/CachePruning.cpp b/llvm/lib/Support/CachePruning.cpp
index e1ad802..141573c2 100644
--- a/llvm/lib/Support/CachePruning.cpp
+++ b/llvm/lib/Support/CachePruning.cpp
@@ -155,8 +155,7 @@ bool llvm::pruneCache(StringRef Path, CachePruningPolicy Policy) {
SmallString<128> TimestampFile(Path);
sys::path::append(TimestampFile, "llvmcache.timestamp");
sys::fs::file_status FileStatus;
- const auto CurrentTime =
- time_point_cast<decltype(Policy.Interval)>(system_clock::now());
+ const auto CurrentTime = system_clock::now();
if (auto EC = sys::fs::status(TimestampFile, FileStatus)) {
if (EC == errc::no_such_file_or_directory) {
// If the timestamp file wasn't there, create one now.
@@ -166,13 +165,14 @@ bool llvm::pruneCache(StringRef Path, CachePruningPolicy Policy) {
return false;
}
} else {
+ if (!Policy.Interval)
+ return false;
if (Policy.Interval != seconds(0)) {
// Check whether the time stamp is older than our pruning interval.
// If not, do nothing.
- const auto TimeStampModTime = time_point_cast<decltype(Policy.Interval)>(
- FileStatus.getLastModificationTime());
+ const auto TimeStampModTime = FileStatus.getLastModificationTime();
auto TimeStampAge = CurrentTime - TimeStampModTime;
- if (TimeStampAge <= Policy.Interval) {
+ if (TimeStampAge <= *Policy.Interval) {
DEBUG(dbgs() << "Timestamp file too recent ("
<< duration_cast<seconds>(TimeStampAge).count()
<< "s old), do not prune.\n");