From 5167c1389b5b52ab68a40debebbace19d03554bf Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 26 Nov 2018 00:03:39 +0000 Subject: [Support/FileSystem] Add sub-second precision for atime/mtime of sys::fs::file_status on unix platforms Summary: getLastAccessedTime() and getLastModificationTime() provided times in nanoseconds but with only 1 second resolution, even when the underlying file system could provide more precise times than that. These changes add sub-second precision for unix platforms that support improved precision. Also add some comments to make sure people are aware that the resolution of times can vary across different file systems. Reviewers: labath, zturner, aaron.ballman, kristina Reviewed By: aaron.ballman, kristina Subscribers: lebedev.ri, mgorny, kristina, llvm-commits Differential Revision: https://reviews.llvm.org/D54826 llvm-svn: 347530 --- llvm/cmake/config-ix.cmake | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/cmake') diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 4bf2a9e9112..900c35ee4f0 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -7,6 +7,7 @@ include(CheckIncludeFile) include(CheckLibraryExists) include(CheckSymbolExists) include(CheckFunctionExists) +include(CheckStructHasMember) include(CheckCCompilerFlag) include(CheckCompilerVersion) @@ -248,6 +249,11 @@ if( HAVE_DLFCN_H ) endif() endif() +CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) +CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) + check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) if( LLVM_USING_GLIBC ) add_definitions( -D_GNU_SOURCE ) -- cgit v1.2.3