aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Host/common/FileSystem.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-11-26 23:40:52 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-11-26 23:40:52 +0000
commit2765b067d2d6ad855394cce8df7c4634163c425f (patch)
tree0254ebaf42eefdabee6671fd82f2be420070f682 /lldb/source/Host/common/FileSystem.cpp
parent9cc1ffadc5ad06ab846a7da95a1afb874b9f3d98 (diff)
downloadllvm-2765b067d2d6ad855394cce8df7c4634163c425f.zip
llvm-2765b067d2d6ad855394cce8df7c4634163c425f.tar.gz
llvm-2765b067d2d6ad855394cce8df7c4634163c425f.tar.bz2
[FileSystem] Ignore nanoseconds when comparing oso_mod_time
After a recent change in LLVM the TimePoint encoding become more precise, exceeding the precision of the TimePoint obtained from the DebugMap. This patch adds a flag to the GetModificationTime helper in the FileSystem to return the modification time with less precision. Thanks to Davide for bisecting this failure on the LLDB bots. llvm-svn: 347615
Diffstat (limited to 'lldb/source/Host/common/FileSystem.cpp')
-rw-r--r--lldb/source/Host/common/FileSystem.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp
index a010599..db218a3 100644
--- a/lldb/source/Host/common/FileSystem.cpp
+++ b/lldb/source/Host/common/FileSystem.cpp
@@ -64,15 +64,22 @@ Optional<FileSystem> &FileSystem::InstanceImpl() {
}
sys::TimePoint<>
-FileSystem::GetModificationTime(const FileSpec &file_spec) const {
- return GetModificationTime(file_spec.GetPath());
+FileSystem::GetModificationTime(const FileSpec &file_spec,
+ bool nanosecond_precision) const {
+ return GetModificationTime(file_spec.GetPath(), nanosecond_precision);
}
-sys::TimePoint<> FileSystem::GetModificationTime(const Twine &path) const {
+sys::TimePoint<>
+FileSystem::GetModificationTime(const Twine &path,
+ bool nanosecond_precision) const {
ErrorOr<vfs::Status> status = m_fs->status(path);
if (!status)
return sys::TimePoint<>();
- return status->getLastModificationTime();
+ if (nanosecond_precision)
+ return status->getLastModificationTime();
+ else
+ return std::chrono::time_point_cast<std::chrono::seconds>(
+ status->getLastModificationTime());
}
uint64_t FileSystem::GetByteSize(const FileSpec &file_spec) const {