MCPcopy Create free account
hub / github.com/Kitware/CMake / Load

Method Load

Source/cmFileTime.cxx:17–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#endif
16
17bool cmFileTime::Load(std::string const& fileName)
18{
19#if !defined(_WIN32) || defined(__CYGWIN__)
20 // POSIX version. Use the stat function.
21 struct stat fst;
22 if (::stat(fileName.c_str(), &fst) != 0) {
23 return false;
24 }
25# if CMake_STAT_HAS_ST_MTIM
26 // Nanosecond resolution
27 this->Time = fst.st_mtim.tv_sec * UtPerS + fst.st_mtim.tv_nsec;
28# elif CMake_STAT_HAS_ST_MTIMESPEC
29 // Nanosecond resolution
30 this->Time = fst.st_mtimespec.tv_sec * UtPerS + fst.st_mtimespec.tv_nsec;
31# else
32 // Second resolution
33 this->Time = fst.st_mtime * UtPerS;
34# endif
35#else
36 // Windows version. Get the modification time from extended file attributes.
37 WIN32_FILE_ATTRIBUTE_DATA fdata;
38 if (!GetFileAttributesExW(cmsys::Encoding::ToWide(fileName).c_str(),
39 GetFileExInfoStandard, &fdata)) {
40 return false;
41 }
42
43 // Copy the file time to the output location.
44 using uint64 = unsigned long long;
45
46 this->Time = static_cast<TimeType>(
47 (uint64(fdata.ftLastWriteTime.dwHighDateTime) << 32) +
48 fdata.ftLastWriteTime.dwLowDateTime);
49#endif
50 return true;
51}

Callers 15

ProcessMethod · 0.45
UpdateMethod · 0.45
FindIncludedHeaderMethod · 0.45
FindIncludedUiMethod · 0.45
ProbeMethod · 0.45
FindDependencyMethod · 0.45
InitFromInfoMethod · 0.45
ParseCacheReadMethod · 0.45
GetNextCandidateMethod · 0.45
GetNextCandidateMethod · 0.45

Calls 2

c_strMethod · 0.80
statClass · 0.70

Tested by 4

ProcessStepsMethod · 0.36
TestQrcRccFilesMethod · 0.36
TestResourcesMethod · 0.36