diff options
Diffstat (limited to 'llvm/lib/Support/CachePruning.cpp')
-rw-r--r-- | llvm/lib/Support/CachePruning.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Support/CachePruning.cpp b/llvm/lib/Support/CachePruning.cpp index 3e97c991f50..e1ad8024096 100644 --- a/llvm/lib/Support/CachePruning.cpp +++ b/llvm/lib/Support/CachePruning.cpp @@ -155,7 +155,8 @@ 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 = system_clock::now(); + const auto CurrentTime = + time_point_cast<decltype(Policy.Interval)>(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. @@ -168,7 +169,8 @@ bool llvm::pruneCache(StringRef Path, CachePruningPolicy Policy) { if (Policy.Interval != seconds(0)) { // Check whether the time stamp is older than our pruning interval. // If not, do nothing. - const auto TimeStampModTime = FileStatus.getLastModificationTime(); + const auto TimeStampModTime = time_point_cast<decltype(Policy.Interval)>( + FileStatus.getLastModificationTime()); auto TimeStampAge = CurrentTime - TimeStampModTime; if (TimeStampAge <= Policy.Interval) { DEBUG(dbgs() << "Timestamp file too recent (" |